/*! @maps4html/web-map-custom-element 29-04-2024 */

!function(){"use strict";function t(t){return new m(t)}function e(t,e){return new c(t,e)}function o(t,e){return new p(t,e)}function i(t,e){return new h(t,e)}function n(t){return new d(t)}function a(t,e){return new _(t,e)}function s(t,e){return new y(t,e)}function r(t,e,o,i,n,a){return new f(t,e,o,i,n,a)}function l(t,e,o){return t||e?new g(t,e,o):null}function u(){return new b}var m=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),this.zoomBounds=this._getZoomBounds(t.tileContainer,t.maxZoomBound),L.extend(this.options,this.zoomBounds),this._groups=this._groupTiles(this.options.tileContainer.getElementsByTagName("map-tile")),this._bounds=this._getLayerBounds(this._groups,this.options.projection),this.layerBounds=this._bounds[Object.keys(this._bounds)[0]];for(var e of Object.keys(this._bounds))this.layerBounds.extend(this._bounds[e].min),this.layerBounds.extend(this._bounds[e].max)},onAdd:function(t){this._map=t,L.GridLayer.prototype.onAdd.call(this,this._map),this._handleMoveEnd()},getEvents:function(){let t=L.GridLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t.move=()=>{},t},isVisible:function(){var t=this._map.getZoom();let e=t;return e=e>this.options.maxNativeZoom?this.options.maxNativeZoom:e,e=e<this.options.minNativeZoom?this.options.minNativeZoom:e,t<=this.zoomBounds.maxZoom&&t>=this.zoomBounds.minZoom&&this._bounds[e]&&this._bounds[e].overlaps(M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection))},_handleMoveEnd:function(t){this.isVisible()&&this._parentOnMoveEnd()},_isValidTile(t){return this._groups[this._tileCoordsToKey(t)]},createTile:function(t){let o=this._groups[this._tileCoordsToKey(t)]||[],i=document.createElement("map-tile"),n=this.getTileSize();i.setAttribute("col",t.x),i.setAttribute("row",t.y),i.setAttribute("zoom",t.z);for(let e=0;e<o.length;e++){let t=document.createElement("img");t.width=n.x,t.height=n.y,t.alt="",t.setAttribute("role","presentation"),t.src=o[e].src,i.appendChild(t)}return i},_getLayerBounds:function(t,e){let o={},i=M[e].options.crs.tile.bounds.max.x;for(var n in t){let t=n.split(":"),e={};e.x=+t[0]*i,e.y=+t[1]*i,e.z=+t[2],t[2]in o?(o[t[2]].extend(L.point(e.x,e.y)),o[t[2]].extend(L.point(e.x+i,e.y+i))):o[t[2]]=L.bounds(L.point(e.x,e.y),L.point(e.x+i,e.y+i))}for(var a in o){var s=+a;o[a]=M.pixelToPCRSBounds(o[a],s,e)}return o},_getZoomBounds:function(t,e){if(!t)return null;let o=M._metaContentToObject(this.options._leafletLayer._layerEl.querySelector("map-meta[name=zoom]").getAttribute("content")),i={},n=t.getElementsByTagName("map-tile");i.nativeZoom=+o.value||0,i.maxNativeZoom=0,i.minNativeZoom=e;for(let e=0;e<n.length;e++){let t=+n[e].getAttribute("zoom");n[e].getAttribute("zoom")||(t=i.nativeZoom),i.minNativeZoom=Math.min(i.minNativeZoom,t),i.maxNativeZoom=Math.max(i.maxNativeZoom,t)}return i.minZoom=+o.min||0,i.maxZoom=+o.max||e,i},_groupTiles:function(o){let i={};for(let e=0;e<o.length;e++){let t={};t.row=+o[e].getAttribute("row"),t.col=+o[e].getAttribute("col"),t.zoom=+o[e].getAttribute("zoom")||this.options.nativeZoom,t.src=o[e].getAttribute("src");var n=t.col+":"+t.row+":"+t.zoom;n in i?i[n].push(t):i[n]=[t]}return i}}),c=L.Control.Layers.extend({options:{autoZIndex:!1,sortLayers:!0,sortFunction:function(t,e){return t.options.zIndex<e.options.zIndex?-1:t.options.zIndex>e.options.zIndex?1:0}},initialize:function(t,e){for(var o in L.setOptions(this,e),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,t)this._addLayer(t[o],o,!0)},onAdd:function(){return this._initLayout(),L.DomEvent.on(this._container.getElementsByTagName("a")[0],"keydown",this._focusFirstLayer,this._container),L.DomEvent.on(this._container,"contextmenu",this._preventDefaultContextMenu,this),this._update(),this._layers.length<1&&!this._map._showControls?this._container.setAttribute("hidden",""):this._map._showControls=!0,this._container},onRemove:function(t){L.DomEvent.off(this._container.getElementsByTagName("a")[0],"keydown",this._focusFirstLayer,this._container)},addOrUpdateOverlay:function(t,e){for(var o=!1,i=0;i<this._layers.length;i++)if(this._layers[i].layer===t){o=!0,this._layers[i].name=e;break}return o||this.addOverlay(t,e),0<this._layers.length&&(this._container.removeAttribute("hidden"),this._map._showControls=!0),this._map?this._update():this},removeLayer:function(t){L.Control.Layers.prototype.removeLayer.call(this,t),0===this._layers.length&&this._container.setAttribute("hidden","")},_checkDisabledLayers:function(){},_focusFirstLayer:function(t){var e;"Enter"!==t.key||"leaflet-control-layers leaflet-control leaflet-control-layers-expanded"!==this.className||(e=this.children[1].children[2].children[0].children[0].children[0].children[0])&&setTimeout(()=>e.focus(),0)},_update:function(){if(!this._container)return this;L.DomUtil.empty(this._baseLayersList),L.DomUtil.empty(this._overlaysList),this._layerControlInputs=[];var t,e,o,i,n=0;for(this.options.sortLayers&&this._layers.sort((t,e)=>this.options.sortFunction(t.layer,e.layer,t.name,e.name)),o=0;o<this._layers.length;o++)i=this._layers[o],this._addItem(i),e=e||i.overlay,t=t||!i.overlay,n+=i.overlay?0:1;return this.options.hideSingleBase&&(this._baseLayersList.style.display=(t=t&&1<n)?"":"none"),this._separator.style.display=e&&t?"":"none",this},_addItem:function(t){var e=t.layer._layerEl._layerControlHTML;return t.input=e.querySelector("input.leaflet-control-layers-selector"),this._layerControlInputs.push(t.input),t.input.layerId=L.stamp(t.layer),this._overlaysList.appendChild(e),e},collapse:function(t){if(this._container.className.includes("expanded")&&this._map.contextMenu._extentLayerMenu.hidden&&this._map.contextMenu._layerMenu.hidden)return"SELECT"===t.target.tagName||t.relatedTarget&&t.relatedTarget.parentElement&&("mapml-contextmenu mapml-layer-menu"===t.relatedTarget.className||"mapml-contextmenu mapml-layer-menu"===t.relatedTarget.parentElement.className)||this._map&&"block"===this._map.contextMenu._layerMenu.style.display||(L.DomUtil.removeClass(this._container,"leaflet-control-layers-expanded"),"touch"===t.originalEvent?.pointerType&&(this._container._isExpanded=!1)),this},_preventDefaultContextMenu:function(t){var e=this._map.mouseEventToLatLng(t),o=this._map.mouseEventToContainerPoint(t);t.preventDefault(),this._container._isExpanded||"touch"!==t.pointerType?this._map.fire("contextmenu",{originalEvent:t,containerPoint:o,latlng:e}):this._container._isExpanded=!0}}),p=L.FeatureGroup.extend({initialize:function(t,e){L.FeatureGroup.prototype.initialize.call(this,null,e),this.options.tiles||(this._container=null,this.options.query||this.options._leafletLayer?this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane):this._container=this.options.pane,L.DomUtil.addClass(this._container,"leaflet-pane mapml-vector-container"),L.setOptions(this.options.renderer,{pane:this._container})),this.options.query?this._queryFeatures=t.features||t:t||this.options._leafletLayer&&(this._features={},this._staticFeature=!0)},isVisible:function(){let n=this.options.mapEl._map;if(this.options.query)return!0;if(this._staticFeature&&0===Object.keys(this._features).length)return!1;{let t=n.getZoom(),e=this.zoomBounds||this.options.zoomBounds,o=this.layerBounds||this.options.layerBounds,i=!!e&&(t<=e.maxZoom&&t>=e.minZoom);return i&&this._layers&&o&&o.overlaps(M.pixelToPCRSBounds(n.getPixelBounds(),t,n.options.projection))}},onAdd:function(t){this._map=t,L.FeatureGroup.prototype.onAdd.call(this,t),this._staticFeature&&this._validateRendering(),this._queryFeatures&&t.on("featurepagination",this.showPaginationFeature,this)},addLayer:function(t){var e;return L.FeatureGroup.prototype.addLayer.call(this,t),this.options.layerBounds||(this.layerBounds=this.layerBounds?this.layerBounds.extend(t.layerBounds):L.bounds(t.layerBounds.min,t.layerBounds.max),this.zoomBounds?(t.zoomBounds.minZoom<this.zoomBounds.minZoom&&(this.zoomBounds.minZoom=t.zoomBounds.minZoom),t.zoomBounds.maxZoom>this.zoomBounds.maxZoom&&(this.zoomBounds.maxZoom=t.zoomBounds.maxZoom),t.zoomBounds.minNativeZoom<this.zoomBounds.minNativeZoom&&(this.zoomBounds.minNativeZoom=t.zoomBounds.minNativeZoom),t.zoomBounds.maxNativeZoom>this.zoomBounds.maxNativeZoom&&(this.zoomBounds.maxNativeZoom=t.zoomBounds.maxNativeZoom)):this.zoomBounds=t.zoomBounds),this._staticFeature&&((e=t.options.mapmlFeature.zoom)in this._features?this._features[e].push(t):this._features[e]=[t],this._validateRendering()),this},addRendering:function(t){L.FeatureGroup.prototype.addLayer.call(this,t)},onRemove:function(t){this._queryFeatures&&(t.off("featurepagination",this.showPaginationFeature,this),delete this._queryFeatures,L.DomUtil.remove(this._container)),L.FeatureGroup.prototype.onRemove.call(this,t),this._map.featureIndex.cleanIndex()},removeLayer:function(o){if(L.FeatureGroup.prototype.removeLayer.call(this,o),!this.options.layerBounds){delete this.layerBounds,delete this.options._leafletLayer.bounds,delete this.zoomBounds,delete this.options._leafletLayer.zoomBounds,delete this._layers[o._leaflet_id],this._removeFromFeaturesList(o);let t,e;var i;for(i of Object.keys(this._layers)){var n=this._layers[i];t?t.extend(n.layerBounds):t=L.bounds(n.layerBounds.min,n.layerBounds.max),e?(n.zoomBounds.minZoom<e.minZoom&&(e.minZoom=n.zoomBounds.minZoom),n.zoomBounds.maxZoom>e.maxZoom&&(e.maxZoom=n.zoomBounds.maxZoom),n.zoomBounds.minNativeZoom<e.minNativeZoom&&(e.minNativeZoom=n.zoomBounds.minNativeZoom),n.zoomBounds.maxNativeZoom>e.maxNativeZoom&&(e.maxNativeZoom=n.zoomBounds.maxNativeZoom)):(e={},e.minZoom=n.zoomBounds.minZoom,e.maxZoom=n.zoomBounds.maxZoom,e.minNativeZoom=n.zoomBounds.minNativeZoom,e.maxNativeZoom=n.zoomBounds.maxNativeZoom)}t?this.layerBounds=t:delete this.layerBounds,e?this.zoomBounds=e:(delete this.zoomBounds,delete this.options.zoomBounds)}return this},removeRendering:function(t){L.FeatureGroup.prototype.removeLayer.call(this,t)},_removeFromFeaturesList:function(t){for(var e in this._features)for(let t=0;t<this._features[e].length;++t){var o=this._features[e][t];if(o._leaflet_id==o._leaflet_id){this._features[e].splice(t,1);break}}},getEvents:function(){return this._staticFeature?{moveend:this._handleMoveEnd,zoomend:this._handleZoomEnd}:{}},showPaginationFeature:function(t){if(this.options.query&&this._queryFeatures[t.i]){let e=this._queryFeatures[t.i];if(e._linkEl.shadowRoot.replaceChildren(),this.clearLayers(),e.meta)for(let t=0;t<e.meta.length;t++)e._linkEl.shadowRoot.appendChild(e.meta[t]);e._linkEl.shadowRoot.appendChild(e),e.addFeature(this),t.popup._navigationBar.querySelector("p").innerText=t.i+1+"/"+this.options._leafletLayer._totalFeatureCount,t.popup._content.querySelector("iframe").setAttribute("sandbox","allow-same-origin allow-forms"),t.popup._content.querySelector("iframe").srcdoc=e.querySelector("map-properties").innerHTML,this._map.fire("attachZoomLink",{i:t.i,currFeature:e}),this._map.once("popupclose",function(t){this.shadowRoot.innerHTML=""},e._linkEl)}},_handleMoveEnd:function(){this._removeCSS()},_handleZoomEnd:function(t){this.zoomBounds&&this._validateRendering()},_validateRendering:function(){this._map&&this._map.featureIndex.cleanIndex();let i=this._map||this.options._leafletLayer._map;if(i.hasLayer(this)&&this._features)for(var n in this._features)for(let o=0;o<this._features[n].length;o++){let e=this._features[n][o],t=e._checkRender(i.getZoom(),this.zoomBounds.minZoom,this.zoomBounds.maxZoom);if(t){if(!i.hasLayer(e)&&!e._map){this.addRendering(e);let t=e.defaultOptions.group.parentNode.querySelector(`span[id="${e._leaflet_id}"]`);t.replaceWith(e.defaultOptions.group)}}else{let t=document.createElement("span");t.id=e._leaflet_id,e.defaultOptions.group.insertAdjacentElement("beforebegin",t),this.removeRendering(e)}}},_setZoomTransform:function(t,e){var o=this._map.getZoomScale(this._map.getZoom(),e),t=t.multiplyBy(o).subtract(this._map._getNewPixelOrigin(t,this._map.getZoom())).round();any3d?L.setTransform(this._layers[e],t,o):L.setPosition(this._layers[e],t)},createGeometry:function(i,n,a){let s=Object.assign({},this.options);if(!s.filter||s.filter(i)){i.classList.length&&(s.className=i.classList.value);let t=i.zoom??a,e=i.querySelector("map-featurecaption");e=e?e.innerHTML:"Feature",i.querySelector("map-properties")&&(s.properties=document.createElement("div"),s.properties.classList.add("mapml-popup-content"),s.properties.insertAdjacentHTML("afterbegin",i.querySelector("map-properties").innerHTML));n=i.getElementsByTagName("map-geometry")[0]?.getAttribute("cs")||n;(this._staticFeature||this.options.query)&&(s.layerBounds=M.extentToBounds(i.extent,"PCRS"),s.zoomBounds=i.extent.zoom);let o=this._geometryToLayer(i,s,n,+t,e);return o&&0!==Object.keys(o._layers).length?(!o.options.color&&i.hasAttribute("class")&&(o.options.className=i.getAttribute("class")),o.defaultOptions=o.options,this.resetStyle(o),s.onEachFeature&&o.bindTooltip(e,{interactive:!0,sticky:!0}),"MAP-FEATURE"===i.tagName.toUpperCase()&&(i._groupEl=o.options.group),o):void 0}},resetStyle:function(t){var e=this.options.style;e&&(L.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(e){this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)},_removeCSS:function(){var e=this._container.querySelectorAll("link[rel=stylesheet],style");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},_geometryToLayer:function(o,i,n,a,s){let r=o.getElementsByTagName("map-geometry")[0],l=[],u=L.SVG.create("g"),m=Object.assign({},i);if(u._featureEl=o,r){for(var c of r.querySelectorAll("map-polygon, map-linestring, map-multilinestring, map-point, map-multipoint"))l.push(M.path(c,Object.assign(m,{nativeCS:n,nativeZoom:a,projection:this.options.projection,featureID:o.id,group:u,wrappers:this._getGeometryParents(c.parentElement),featureLayer:this,_leafletLayer:this.options._leafletLayer})));let t={group:u,mapmlFeature:o,featureID:o.id,accessibleTitle:s,onEachFeature:i.onEachFeature,properties:i.properties,_leafletLayer:this.options._leafletLayer,layerBounds:i.layerBounds,zoomBounds:i.zoomBounds},e=r.querySelector("map-multipolygon")||r.querySelector("map-geometrycollection");return e&&(t.wrappers=this._getGeometryParents(e.parentElement)),M.geometry(l,t)}},_getGeometryParents:function(t,e=[]){return t&&"MAP-GEOMETRY"!==t.tagName.toUpperCase()?"MAP-MULTIPOLYGON"===t.tagName.toUpperCase()||"MAP-GEOMETRYCOLLECTION"===t.tagName.toUpperCase()?this._getGeometryParents(t.parentElement,e):this._getGeometryParents(t.parentElement,e.concat([t])):e}}),h=L.TileLayer.extend({initialize:function(t,e){e.tms=t.tms,this.zoomBounds=Object.assign({},e.zoomBounds),L.extend(e,this.zoomBounds),L.setOptions(this,e),this._setUpTileTemplateVars(t),this._linkEl=e.linkEl,this.extentBounds=this.options.extentBounds,delete this.options.zoomBounds,delete this.options.extentBounds,this._template=t,this._initContainer(),L.TileLayer.prototype.initialize.call(this,t.template,L.extend(e,{pane:this.options.pane}))},onAdd:function(t){this.options.pane.appendChild(this._container),L.TileLayer.prototype.onAdd.call(this,t),this._handleMoveEnd()},onRemove:function(){L.DomUtil.remove(this._container);for(var t of this._container.children)L.DomUtil.remove(t)},getEvents:function(){let t=L.TileLayer.prototype.getEvents.call(this,this._map);return this._parentOnMoveEnd=t.moveend,t.moveend=this._handleMoveEnd,t},isVisible:function(){let t=this._linkEl.getMapEl()._map;var e=t.getZoom(),o=M.pixelToPCRSBounds(t.getPixelBounds(),e,t.options.projection);return e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(o)},_initContainer:function(){this._container||(this._container=L.DomUtil.create("div","leaflet-layer",this.options.pane),L.DomUtil.addClass(this._container,"mapml-templated-tile-container"),this._updateZIndex())},_handleMoveEnd:function(t){this.isVisible()&&this._parentOnMoveEnd()},createTile:function(e){let o=document.createElement("DIV"),i=this.getTileSize();if(L.DomUtil.addClass(o,"mapml-tile-group"),L.DomUtil.addClass(o,"leaflet-tile"),this._template.linkEl.dispatchEvent(new CustomEvent("tileloadstart",{detail:{x:e.x,y:e.y,zoom:e.z,appendTile:t=>{o.appendChild(t)}}})),this._template.type.startsWith("image/")){let t=L.TileLayer.prototype.createTile.call(this,e,function(){});t.width=i.x,t.height=i.y,o.appendChild(t)}else this._url.includes(M.BLANK_TT_TREF)||this._fetchTile(e,o);return o},_mapmlTileReady:function(t){L.DomUtil.addClass(t,"leaflet-tile-loaded")},getPane:function(){return this.options.pane},_fetchTile:function(e,o){var t=this.getTileUrl(e);t&&fetch(t,{redirect:"follow"}).then(function(t){return 200<=t.status&&t.status<300?Promise.resolve(t):(console.log("Looks like there was a problem. Status Code: "+t.status),Promise.reject(t))}).then(function(t){return t.text()}).then(t=>{return(new DOMParser).parseFromString(t,"application/xml")}).then(t=>{this._createFeatures(t,e,o),this._mapmlTileReady(o)}).catch(t=>{console.log("Error Creating Tile")})},_parseStylesheetAsHTML:function(t,e,o){if(o instanceof Element&&t&&t.querySelector("map-link[rel=stylesheet],map-style")){if(e instanceof Element)e=e.getAttribute("href")?e.getAttribute("href"):document.URL;else if(!e||""===e||e instanceof Object)return;for(var i,n,a=[],s=t.querySelectorAll("map-link[rel=stylesheet],map-style"),r=0;r<s.length;r++)"MAP-LINK"===s[r].nodeName.toUpperCase()?(i=s[r].hasAttribute("href")?new URL(s[r].getAttribute("href"),e).href:null)&&(o.querySelector("link[href='"+i+"']")||(n=document.createElement("link"),u(s[r],n),n.setAttribute("href",i),a.push(n))):(n=document.createElement("style"),u(s[r],n),n.textContent=s[r].textContent,a.push(n));for(var l=a.length-1;0<=l;l--)o.insertAdjacentElement("afterbegin",a[l])}function u(t,e){return Array.from(t.attributes).forEach(t=>{"href"!==t.nodeName&&e.setAttribute(t.nodeName,t.nodeValue)})}},_createFeatures:function(t,e,o){var i;t.querySelector("map-link[rel=stylesheet],map-style")&&(i=t.querySelector("map-base")&&t.querySelector("map-base").hasAttribute("href")?new URL(t.querySelector("map-base").getAttribute("href")).href:t.URL,this._parseStylesheetAsHTML(t,i,o));let n=L.SVG.create("svg"),a=L.SVG.create("g"),s=this._map.options.crs.options.crs.tile.bounds.max.x,r=e.x*s,l=e.y*s,u=M.featureLayer(null,{projection:this._map.options.projection,tiles:!0,layerBounds:this.extentBounds,zoomBounds:this.zoomBounds,interactive:!1,mapEl:this._linkEl.getMapEl()});var m=M.getNativeVariables(t),c=t.querySelectorAll("map-feature:has(> map-geometry)");for(let t=0;t<c.length;t++){var p,h=u.createGeometry(c[t],m.cs,e.z);for(p in h._layers){let t=h._layers[p];M.FeatureRenderer.prototype._initPath(t,!1),t._project(this._map,L.point([r,l]),e.z),M.FeatureRenderer.prototype._addPath(t,a,!1),M.FeatureRenderer.prototype._updateFeature(t)}}n.setAttribute("width",s.toString()),n.setAttribute("height",s.toString()),n.appendChild(a),o.appendChild(n)},getTileUrl:function(t){if(t.z>=this._template.tilematrix.bounds.length||!this._template.tilematrix.bounds[t.z].contains(t))return"";var e,o={},i=this._template.linkEl,n=i.zoomInput;for(e in o[this._template.tilematrix.col.name]=t.x,o[this._template.tilematrix.row.name]=t.y,n&&i.hasAttribute("tref")&&i.getAttribute("tref").includes(`{${n.getAttribute("name")}}`)&&(o[this._template.zoom.name]=this._getZoomForUrl()),o[this._template.pcrs.easting.left]=this._tileMatrixToPCRSPosition(t,"top-left").x,o[this._template.pcrs.easting.right]=this._tileMatrixToPCRSPosition(t,"top-right").x,o[this._template.pcrs.northing.top]=this._tileMatrixToPCRSPosition(t,"top-left").y,o[this._template.pcrs.northing.bottom]=this._tileMatrixToPCRSPosition(t,"bottom-left").y,this._template.tile)["row","col","zoom","left","right","top","bottom"].indexOf(e)<0&&(o[e]=this._template.tile[e]);return this._map&&!this._map.options.crs.infinite&&(t=this._globalTileRange.max.y-t.y,this.options.tms&&(o[this._template.tilematrix.row.name]=t)),o.r=this.options.detectRetina&&L.Browser.retina&&0<this.options.maxZoom?"@2x":"",L.Util.template(this._url,o)},_tileMatrixToPCRSPosition:function(t,e){var o=this._map.options.crs,i=this.getTileSize(),n=t.scaleBy(i),a=n.add(i),i=n.add(Math.floor(i/2)),s=o.transformation.untransform(n,o.scale(t.z)),r=o.transformation.untransform(a,o.scale(t.z)),l=o.transformation.untransform(i,o.scale(t.z)),u=null;switch(e){case"top-left":u=s;break;case"bottom-left":u=new L.Point(s.x,r.y);break;case"center-left":u=new L.Point(s.x,l.y);break;case"top-right":u=new L.Point(r.x,s.y);break;case"bottom-right":u=r;break;case"center-right":u=new L.Point(r.x,l.y);break;case"top-center":u=new L.Point(l.x,s.y);break;case"bottom-center":u=new L.Point(l.x,r.y);break;case"center":u=l}return u},_setUpTileTemplateVars:function(t){t.tile={};for(var e,o,i,n,a=t.values,s=this.options.crs.options,r=0;r<t.values.length;r++){var l=a[r].getAttribute("type"),u=a[r].getAttribute("units"),m=a[r].getAttribute("axis"),c=a[r].getAttribute("name"),p=a[r].getAttribute("position"),h="map-select"===a[r].tagName.toLowerCase(),d=(a[r].getAttribute("value"),a[r].getAttribute("min")),_=a[r].getAttribute("max");if("location"===l&&"tilematrix"===u)switch(m){case"column":n={name:c,min:s.crs.tilematrix.horizontal.min,max:s.crs.tilematrix.horizontal.max(s.resolutions.length-1)},isNaN(Number.parseFloat(d))||(n.min=Number.parseFloat(d)),isNaN(Number.parseFloat(_))||(n.max=Number.parseFloat(_));break;case"row":i={name:c,min:s.crs.tilematrix.vertical.min,max:s.crs.tilematrix.vertical.max(s.resolutions.length-1)},isNaN(Number.parseFloat(d))||(i.min=Number.parseFloat(d)),isNaN(Number.parseFloat(_))||(i.max=Number.parseFloat(_));break;case"longitude":case"easting":e=e||{min:s.crs.pcrs.horizontal.min,max:s.crs.pcrs.horizontal.max},isNaN(Number.parseFloat(d))||(e.min=Number.parseFloat(d)),isNaN(Number.parseFloat(_))||(e.max=Number.parseFloat(_)),p&&(p.match(/.*?-left/i)?e.left=c:p.match(/.*?-right/i)&&(e.right=c));break;case"latitude":case"northing":o=o||{min:s.crs.pcrs.vertical.min,max:s.crs.pcrs.vertical.max},isNaN(Number.parseFloat(d))||(o.min=Number.parseFloat(d)),isNaN(Number.parseFloat(_))||(o.max=Number.parseFloat(_)),p&&(p.match(/top-.*?/i)?o.top=c:p.match(/bottom-.*?/i)&&(o.bottom=c))}else if(h){const S=a[r].htmlselect;t.tile[c]=function(){return S.value}}else if("hidden"===l){const T=a[r];t.tile[c]=function(){return T.getAttribute("value")}}}function y(t,e){return f.transform(t,b(e)).divideBy(g).floor()}var f=this.options.crs.transformation,g=this.options.crs.options.crs.tile.bounds.max.x,b=L.bind(this.options.crs.scale,this.options.crs);e&&o?(t.pcrs={},t.pcrs.bounds=L.bounds([e.min,o.min],[e.max,o.max]),t.pcrs.easting=e,t.pcrs.northing=o):n&&i&&!isNaN(t.zoom.initialValue)&&(t.pcrs||(t.pcrs={},t.pcrs.easting="",t.pcrs.northing=""),t.pcrs.bounds=M.boundsToPCRSBounds(L.bounds(L.point([n.min,i.min]),L.point([n.max,i.max])),t.zoom.initialValue,this.options.crs,M.axisToCS("column")),t.tilematrix={},t.tilematrix.col=n,t.tilematrix.row=i),t.tilematrix||(t.tilematrix={},t.tilematrix.col={},t.tilematrix.row={}),t.tilematrix.bounds=[];for(var x=t.pcrs.bounds,v=this.options.minNativeZoom,C=this.options.maxNativeZoom,E=0;E<=C;E++)t.tilematrix.bounds[E]=v<=E?L.bounds(y(x.min,E),y(x.max,E)):L.bounds(L.point([-1,-1]),L.point([-1,-1]))},_clampZoom:function(t){var e=L.GridLayer.prototype._clampZoom.call(this,t);return this._template.step>this.options.maxNativeZoom&&(this._template.step=this.options.maxNativeZoom),t!==e?t=e:t%this._template.step!=0&&(t=Math.floor(t/this._template.step)*this._template.step),t}}),d=L.LayerGroup.extend({initialize:function(t){L.LayerGroup.prototype.initialize.call(this,null,t),this._container=L.DomUtil.create("div","leaflet-layer"),this._extentEl=this.options.extentEl,this.changeOpacity(this.options.opacity),L.DomUtil.addClass(this._container,"mapml-extentlayer-container")},getEvents:function(){return{zoomstart:this._onZoomStart}},_onZoomStart:function(){this.closePopup()},getContainer:function(){return this._container},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t);let e=this.options.extentEl.parentLayer._layer._container;e.appendChild(this._container)},redraw:function(){this.eachLayer(function(t){t.redraw()})},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(){L.LayerGroup.prototype.onRemove.call(this,this._map),L.DomUtil.remove(this._container)},_previousFeature:function(t){0<=this._count+-1&&(this._count--,this._map.fire("featurepagination",{i:this._count,popup:this}))},_nextFeature:function(t){this._count+1<this._source._totalFeatureCount&&(this._count++,this._map.fire("featurepagination",{i:this._count,popup:this}))},changeOpacity:function(t){this._container.style.opacity=t,this._extentEl._opacity=t,this._extentEl._opacitySlider&&(this._extentEl._opacitySlider.value=t)},appendStyleLink:function(e){if(e.link){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.link)}},_getStylePositionAndNode:function(){return this._container.lastChild&&("SVG"===this._container.lastChild.nodeName.toUpperCase()||this._container.lastChild.classList.contains("mapml-vector-container"))?{position:"beforebegin",node:this._container.lastChild}:this._container.lastChild?{position:"afterend",node:this._container.lastChild}:{position:"afterbegin",node:this._container}},appendStyleElement:function(e){if(e.styleElement){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.styleElement)}}}),_=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-features-container"),this.zoomBounds=e.zoomBounds,this.extentBounds=e.extentBounds,delete e.zoomBounds,delete e.extentBounds,this._linkEl=e.linkEl,L.setOptions(this,L.extend(e,this._setUpFeaturesTemplateVars(t)))},isVisible:function(){let t=this._linkEl.getMapEl()._map;var e=t.getZoom(),o=M.pixelToPCRSBounds(t.getPixelBounds(),e,t.options.projection);return e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(o)},getEvents:function(){return{moveend:this._onMoveEnd}},onAdd:function(e){this._map=e,this.options.pane.appendChild(this._container);var t=this.options.opacity||1,o=this._container;this._features?this._features.eachLayer(t=>t.addTo(e)):this._features=M.featureLayer(null,{renderer:M.featureRenderer(),pane:o,layerBounds:this.extentBounds,zoomBounds:this.zoomBounds,opacity:t,projection:e.options.projection,mapEl:this._linkEl.getMapEl(),onEachFeature:function(t,e){var o=document.createElement("div");o.classList.add("mapml-popup-content"),o.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(o,{autoClose:!1,minWidth:108})}}),this._onMoveEnd()},onRemove:function(){this._features&&this._features.eachLayer(t=>t.remove()),L.DomUtil.remove(this._container)},appendStyleLink:function(e){if(e.link){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.link)}},_getStylePositionAndNode:function(){return this._container.lastChild&&("SVG"===this._container.lastChild.nodeName.toUpperCase()||this._container.lastChild.classList.contains("mapml-vector-container"))?{position:"beforebegin",node:this._container.lastChild}:this._container.lastChild?{position:"afterend",node:this._container.lastChild}:{position:"afterbegin",node:this._container}},appendStyleElement:function(e){if(e.styleElement){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.styleElement)}},redraw:function(){this._onMoveEnd()},_removeCSS:function(){var o=this._container.querySelectorAll("link[rel=stylesheet],style");for(let e=0;e<o.length;e++){let t=o[e].parentNode;t.removeChild(o[e])}},_onMoveEnd:function(){var t=this._map.options.mapEl._history,e=t[t.length-1],o=t[t.length-2]??e,i=this._template.step,t=this._map.getZoom();let n=t;if("1"!==i&&(t+1)%i==0&&e.zoom===o.zoom-1||e.zoom===o.zoom||Math.floor(t/i)*i!=Math.floor(o.zoom/i)*i)n=Math.floor(t/i)*i;else if(t%this._template.step!=0)return;var r,l,u,m,c,a,s,p,i=this._map.getPixelBounds(this._map.getCenter(),n),i=this._getfeaturesUrl(n,i);i!==this._url&&(this._features.clearLayers(),this._linkEl.shadowRoot&&(this._linkEl.shadowRoot.innerHTML=""),this._removeCSS(),this.isVisible()||n!==t?(l=new Headers({Accept:"text/mapml;q=0.9,application/geo+json;q=0.8"}),u=new DOMParser,m=this._features,c=this._linkEl,a=this._map,p=function(a,s){return fetch(a,{redirect:"follow",headers:l}).then(function(t){return t.text()}).then(function(t){r=u.parseFromString(t,"application/xml");t=new URL(r.querySelector("map-base")?r.querySelector("map-base").getAttribute("href"):a).href;a=(a=r.querySelector("map-link[rel=next]")?r.querySelector("map-link[rel=next]").getAttribute("href"):null)?new URL(a,t).href:null;let e=document.createDocumentFragment();var o=r.querySelectorAll("map-head > *, map-body > *");for(let t=0;t<o.length;t++)e.appendChild(o[t]);c.shadowRoot.appendChild(e);let i=c.shadowRoot.querySelectorAll("map-feature"),n=[];for(let t=0;t<i.length;t++)n.push(i[t].whenReady());if(Promise.allSettled(n).then(()=>{for(let t=0;t<i.length;t++)i[t].addFeature(m)}),a&&--s)return p(a,s)})},(s=this)._url=i,p(i,10).then(function(){a.addLayer(m),a.fire("templatedfeatureslayeradd"),M.TemplatedFeaturesLayer.prototype._updateTabIndex(s)}).catch(function(t){console.log(t)})):this._url="")},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateTabIndex:function(t){var o,i=t||this;for(o in i._features._layers){let e=i._features._layers[o];if(e._path&&("M0 0"!==e._path.getAttribute("d")?e._path.setAttribute("tabindex",0):e._path.removeAttribute("tabindex"),0===e._path.childElementCount)){let t=document.createElement("title");t.innerText="Feature",e._path.appendChild(t)}}},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},_getfeaturesUrl:function(t,e){void 0===t&&(t=this._map.getZoom()),void 0===e&&(e=this._map.getPixelBounds());var o,i={};for(o in this.options.feature.zoom&&(i[this.options.feature.zoom]=t),this.options.feature.width&&(i[this.options.feature.width]=this._map.getSize().x),this.options.feature.height&&(i[this.options.feature.height]=this._map.getSize().y),this.options.feature.bottom&&(i[this.options.feature.bottom]=this._TCRSToPCRS(e.max,t).y),this.options.feature.left&&(i[this.options.feature.left]=this._TCRSToPCRS(e.min,t).x),this.options.feature.top&&(i[this.options.feature.top]=this._TCRSToPCRS(e.min,t).y),this.options.feature.right&&(i[this.options.feature.right]=this._TCRSToPCRS(e.max,t).x),this.options.feature)["width","height","left","right","top","bottom","zoom"].indexOf(o)<0&&(i[o]=this.options.feature[o]);return L.Util.template(this._template.template,i)},_TCRSToPCRS:function(t,e){var o=this._map.options.crs;return o.transformation.untransform(t,o.scale(e))},_setUpFeaturesTemplateVars:function(t){var e={feature:{}},o=t.values;e.feature.hidden=[];for(var i=0;i<o.length;i++){var n=o[i].getAttribute("type"),a=o[i].getAttribute("units"),s=o[i].getAttribute("axis"),r=o[i].getAttribute("name"),l=o[i].getAttribute("position"),u=(o[i].getAttribute("value"),"map-select"===o[i].tagName.toLowerCase());if("width"===n)e.feature.width=r;else if("height"===n)e.feature.height=r;else if("zoom"===n)e.feature.zoom=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const m=o[i].htmlselect;e.feature[r]=function(){return m.value}}else{const c=o[i];e.feature[r]=function(){return c.getAttribute("value")}}else switch(s){case"x":case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.feature.left=r:l.match(/.*?-right/i)&&(e.feature.right=r));break;case"y":case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.feature.top=r:l.match(/bottom-.*?/i)&&(e.feature.bottom=r))}}return e}}),y=L.Layer.extend({initialize:function(t,e){this._template=t,this._container=L.DomUtil.create("div","leaflet-layer"),L.DomUtil.addClass(this._container,"mapml-image-container"),this._linkEl=e.linkEl,this.zoomBounds=e.zoomBounds,this.extentBounds=e.extentBounds,delete e.zoomBounds,delete e.extentBounds,L.setOptions(this,L.extend(e,this._setUpExtentTemplateVars(t)))},getEvents:function(){return{moveend:this._onMoveEnd,zoomstart:this._clearLayer}},onAdd:function(t){this._map=t,this.options.pane.appendChild(this._container),this.setZIndex(this.options.zIndex),this._onAdd()},redraw:function(){this._onMoveEnd()},isVisible:function(){let t=this._linkEl.getMapEl()._map;var e=t.getZoom(),o=M.pixelToPCRSBounds(t.getPixelBounds(),e,t.options.projection);return e<=this.zoomBounds.maxZoom&&e>=this.zoomBounds.minZoom&&this.extentBounds.overlaps(o)},_clearLayer:function(){var e=this._container.querySelectorAll("img");for(let t=0;t<e.length;t++)this._container.removeChild(e[t])},_addImage:function(t,e,o){let i=this._map,n=this._imageOverlay;t=this.getImageUrl(t,e),e=i.getSize();this._imageOverlay=M.imageLayer(t,o,e,0,this._container),this._imageOverlay._step=this._template.step,this._imageOverlay.addTo(i),n&&(this._imageOverlay._overlayToRemove=n._url,this._imageOverlay.on("load error",function(){i.removeLayer(n)}))},_scaleImage:function(o,i){let n=this;setTimeout(function(){var t,e;n._map&&(t=n._template.step,e=Math.floor(i/t)*t,t=n._map.getZoomScale(i,e),e=o.min.multiplyBy(t).subtract(n._map._getNewPixelOrigin(n._map.getCenter(),i)).round(),L.DomUtil.setTransform(n._imageOverlay._image,e,t))})},_onAdd:function(){var t=this._map.getZoom();let e=t;var o=this._template.step;t%o!=0&&(e=Math.floor(t/o)*o);var i=this._map.getPixelBounds(this._map.getCenter(),e);this._pixelOrigins={},this._pixelOrigins[e]=i.min;o=this._map.getPixelBounds().min.subtract(this._map.getPixelOrigin());this._addImage(i,e,o),t!==e&&this._scaleImage(i,t)},_onMoveEnd:function(t){var e=this._map.getZoom(),o=this._map.options.mapEl._history,i=o[o.length-1];let n=o[o.length-2];n=n||i;var a,s=this._template.step,o=Math.floor(e/s)*s;let r=this._map.getPixelBounds(this._map.getCenter(),o);"1"!==s&&(e+1)%s==0&&i.zoom===n.zoom-1?(this._addImage(r,o,L.point(0,0)),this._scaleImage(r,e)):t&&e%s!=0?(this._imageOverlay._overlayToRemove=this._imageOverlay._url,i.zoom!==n.zoom?(this._addImage(r,o,L.point(0,0)),this._pixelOrigins[o]=r.min,this._scaleImage(r,e)):(a=this._pixelOrigins[o],a=r.min.subtract(a),this.getImageUrl(r,o)!==this._imageOverlay._url&&(this._addImage(r,o,a),this._scaleImage(r,e)))):this.isVisible?(a=(o=this._map).getPixelBounds().min.subtract(o.getPixelOrigin()),this._addImage(o.getPixelBounds(),e,a),this._pixelOrigins[e]=o.getPixelOrigin()):this._clearLayer()},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},onRemove:function(t){L.DomUtil.remove(this._container),this._clearLayer()},getImageUrl:function(t,e){var o,i={};for(o in i[this.options.extent.width]=this._map.getSize().x,i[this.options.extent.height]=this._map.getSize().y,i[this.options.extent.bottom]=this._TCRSToPCRS(t.max,e).y,i[this.options.extent.left]=this._TCRSToPCRS(t.min,e).x,i[this.options.extent.top]=this._TCRSToPCRS(t.min,e).y,i[this.options.extent.right]=this._TCRSToPCRS(t.max,e).x,this.options.extent)["width","height","left","right","top","bottom"].indexOf(o)<0&&(i[o]=this.options.extent[o]);return L.Util.template(this._template.template,i)},_TCRSToPCRS:function(t,e){var o=this._map.options.crs;return o.transformation.untransform(t,o.scale(e))},_setUpExtentTemplateVars:function(t){for(var e={extent:{}},o=t.values,i=0;i<t.values.length;i++){var n=o[i].getAttribute("type"),a=o[i].getAttribute("units"),s=o[i].getAttribute("axis"),r=o[i].getAttribute("name"),l=o[i].getAttribute("position"),u="map-select"===o[i].tagName.toLowerCase();if("width"===n)e.extent.width=r;else if("height"===n)e.extent.height=r;else if("location"!==n||"pcrs"!==a&&"gcrs"!==a)if(u){const m=o[i].htmlselect;e.extent[r]=function(){return m.value}}else{const c=o[i];e.extent[r]=function(){return c.getAttribute("value")}}else switch(s){case"longitude":case"easting":l&&(l.match(/.*?-left/i)?e.extent.left=r:l.match(/.*?-right/i)&&(e.extent.right=r));break;case"latitude":case"northing":l&&(l.match(/top-.*?/i)?e.extent.top=r:l.match(/bottom-.*?/i)&&(e.extent.bottom=r))}}return e}}),f=L.ImageOverlay.extend({initialize:function(t,e,o,i,n,a){this._container=n,this._url=t,this._location=e,this._size=L.point(o),this._angle=i,L.setOptions(this,a)},getEvents:function(){var t={viewreset:this._reset};return this._zoomAnimated&&this._step<=1&&(t.zoomanim=this._animateZoom),t},onAdd:function(t){this.on({load:this._onImageLoad}),this._image||this._initImage(),this.options.interactive&&(L.DomUtil.addClass(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this._container.appendChild(this._image),this._reset()},onRemove:function(){L.DomUtil.remove(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},_onImageLoad:function(){this._image&&(this._image.loaded=+new Date,this._updateOpacity())},_animateZoom:function(t){var e=this._map.getZoomScale(t.zoom),t=this._map.getPixelOrigin().add(this._location).multiplyBy(e).subtract(this._map._getNewPixelOrigin(t.center,t.zoom)).round();L.Browser.any3d?L.DomUtil.setTransform(this._image,t,e):L.DomUtil.setPosition(this._image,t)},_reset:function(t){var e=this._image,o=this._location,i=this._size;t&&1<this._step&&(void 0===this._overlayToRemove||this._url===this._overlayToRemove)||(L.DomUtil.setPosition(e,o),e.style.width=i.x+"px",e.style.height=i.y+"px")},_updateOpacity:function(){var t,e,o;this._map&&(o=+new Date,t=!1,e=this._image,o=Math.min(1,(o-e.loaded)/200),L.DomUtil.setOpacity(e,o),(t=o<1?!0:t)&&(L.Util.cancelAnimFrame(this._fadeFrame),this._fadeFrame=L.Util.requestAnimFrame(this._updateOpacity,this)),L.DomUtil.addClass(e,"leaflet-image-loaded"))}}),g=L.LayerGroup.extend({options:{zIndex:0,opacity:"1.0"},initialize:function(t,e,o){L.LayerGroup.prototype.initialize.call(this,null,o),t&&(this._href=t),this._layerEl=e,this._content=e.src?e.shadowRoot:e,L.setOptions(this,o),this._container=L.DomUtil.create("div","leaflet-layer"),this.changeOpacity(this.options.opacity),L.DomUtil.addClass(this._container,"mapml-layer"),this._mapmlTileContainer=L.DomUtil.create("div","mapml-tile-container",this._container),this._initialize(this._content)},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getHref:function(){return this._href??""},_updateZIndex:function(){this._container&&void 0!==this.options.zIndex&&null!==this.options.zIndex&&(this._container.style.zIndex=this.options.zIndex)},changeOpacity:function(t){this._container.style.opacity=t,this._layerEl._opacity=t,this._layerEl._opacitySlider&&(this._layerEl._opacitySlider.value=t)},titleIsReadOnly(){return!!this._titleIsReadOnly},setName(t){this.titleIsReadOnly()||(this._title=t,this._layerEl._layerControlHTML.querySelector(".mapml-layer-item-name").innerHTML=t)},getName(){return this._title},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t),this.getPane().appendChild(this._container),this._staticTileLayer&&this.addLayer(this._staticTileLayer),this.setZIndex(this.options.zIndex),t.on("popupopen",this._attachSkipButtons,this)},_calculateBounds:function(){delete this.bounds,delete this.zoomBounds;let s,r;var t;s=this._layerEl.src&&this._layerEl.shadowRoot.querySelector(":host > map-meta[name=extent][content]")?M.getBoundsFromMeta(this._layerEl.shadowRoot):this._layerEl.querySelector(":scope > map-meta[name=extent][content]")?M.getBoundsFromMeta(this._layerEl):void 0,r=this._layerEl.src&&this._layerEl.shadowRoot.querySelector(":host > map-meta[name=zoom][content]")?M.getZoomBoundsFromMeta(this._layerEl.shadowRoot):this._layerEl.querySelector(":scope > map-meta[name=zoom][content]")?M.getZoomBoundsFromMeta(this._layerEl):void 0;const l=(this._layerEl.src?this._layerEl.shadowRoot:this._layerEl).querySelectorAll("map-extent");["_staticTileLayer","_mapmlvectors","_extentLayer"].forEach(t=>{let e,o,i,n;if(r&&(e=r.maxZoom,o=r.minZoom,n=r.maxNativeZoom||-1/0,i=r.minNativeZoom||1/0),"_extentLayer"===t&&l.length)for(let t=0;t<l.length;t++){var a;l[t]._extentLayer.bounds&&(a=l[t]._extentLayer,s?s.extend(a.bounds):s=L.bounds(a.bounds.min,a.bounds.max),a.zoomBounds&&(r?(e=Math.max(e,a.zoomBounds.maxZoom),o=Math.min(o,a.zoomBounds.minZoom),n=Math.max(n,a.zoomBounds.maxNativeZoom),i=Math.min(i,a.zoomBounds.minNativeZoom),r.minZoom=o,r.maxZoom=e,r.minNativeZoom=i,r.maxNativeZoom=n):r=a.zoomBounds))}else("_mapmlvectors"===t||"_staticTileLayer"===t&&this._staticTileLayer)&&(this[t].layerBounds&&(s?s.extend(this[t].layerBounds):s=this[t].layerBounds),this[t].zoomBounds&&(r?(e=Math.max(e,this[t].zoomBounds.maxZoom),o=Math.min(o,this[t].zoomBounds.minZoom),n=Math.max(n,this[t].zoomBounds.maxNativeZoom),i=Math.min(i,this[t].zoomBounds.minNativeZoom),r.minZoom=o,r.maxZoom=e,r.minNativeZoom=i,r.maxNativeZoom=n):r=this[t].zoomBounds))}),s?this.bounds=s:(t=M[this.options.projection].options.bounds,this.bounds=L.bounds(t.min,t.max)),r=r||{},r.minZoom||(r.minZoom=0),r.maxZoom||(r.maxZoom=M[this.options.projection].options.resolutions.length-1),r.minNativeZoom===1/0&&(r.minNativeZoom=r.minZoom),r.maxNativeZoom===-1/0&&(r.maxNativeZoom=r.maxZoom),this.zoomBounds=r},onRemove:function(t){L.LayerGroup.prototype.onRemove.call(this,t),L.DomUtil.remove(this._container),t.off("popupopen",this._attachSkipButtons)},getAttribution:function(){return this.options.attribution},getBase:function(){return new URL(this._content.querySelector("map-base")?this._content.querySelector("map-base").getAttribute("href"):"LAYER-"===this._content.nodeName?this._content.baseURI:this._href,this._href).href},appendStyleLink:function(e){if(e.link){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.link)}},_getStylePositionAndNode:function(){return this._container.lastChild&&("SVG"===this._container.lastChild.nodeName.toUpperCase()||this._container.lastChild.classList.contains("mapml-vector-container"))?{position:"beforebegin",node:this._container.lastChild}:this._container.lastChild?{position:"afterend",node:this._container.lastChild}:{position:"afterbegin",node:this._container}},appendStyleElement:function(e){if(e.styleElement){let t=this._getStylePositionAndNode();t.node.insertAdjacentElement(t.position,e.styleElement)}},_initialize:function(){var t,n=this,a=(n.getBase(),this._content);!function(){var t=a.querySelector("map-link[rel=license]");t&&(e=t.getAttribute("title"),t=t.getAttribute("href"),e='<a href="'+t+'" title="'+e+'">'+e+"</a>");L.setOptions(n,{attribution:e});var e=a.querySelector("map-link[rel=legend]");e&&(n._legendUrl=e.getAttribute("href"));n._map&&n._map.hasLayer(n)&&n._map.attributionControl.addAttribution(n.getAttribution())}(),a.querySelector("map-title")?(n._title=a.querySelector("map-title").textContent.trim(),n._titleIsReadOnly=!0):a instanceof Element&&a.hasAttribute("label")&&(n._title=a.getAttribute("label").trim()),M[n.options.projection]&&function(){if(a.querySelector("map-tile")){var t=document.createElement("map-tiles"),e=a.querySelector("map-meta[name=zoom][content]")||a.querySelector("map-input[type=zoom][value]");t.setAttribute("zoom",e&&e.getAttribute("content")||e&&e.getAttribute("value")||"0");for(var o=a.getElementsByTagName("map-tile"),i=0;i<o.length;i++)t.appendChild(document.importNode(o[i],!0));n._mapmlTileContainer.appendChild(t),n._staticTileLayer=M.staticTileLayer({pane:n._container,_leafletLayer:n,projection:n.options.projection,className:"mapml-static-tile-layer",tileContainer:n._mapmlTileContainer,maxZoomBound:M[n.options.projection].options.resolutions.length-1,tileSize:M[n.options.projection].options.crs.tile.bounds.max.x})}}(),t=M.getNativeVariables(n._content),n._mapmlvectors=M.featureLayer(null,{renderer:M.featureRenderer(),pane:n._container,opacity:n.options.opacity,projection:n.options.projection,native:t,_leafletLayer:n,mapEl:n._layerEl.parentElement,onEachFeature:function(t,e){var o;t&&((o=document.createElement("div")).classList.add("mapml-popup-content"),o.insertAdjacentHTML("afterbegin",t.innerHTML),e.bindPopup(o,{autoClose:!1,minWidth:165}))}}).addTo(n),n._layerEl.parentElement&&n._layerEl.parentElement._toggleControls()},getQueryTemplates:function(e,o){const i=this._layerEl.querySelectorAll("map-extent[checked] map-link[rel=query]").length?this._layerEl.querySelectorAll("map-extent[checked] map-link[rel=query]"):this._layerEl.shadowRoot.querySelectorAll("map-extent[checked] map-link[rel=query]").length?this._layerEl.shadowRoot.querySelectorAll("map-extent[checked] map-link[rel=query]"):null;if(i){var n=[];for(let t=0;t<i.length;t++){const s=i[t].extent.zoom.minZoom,r=i[t].extent.zoom.maxZoom,l=i[t].getBounds();l.contains(e)&&(a=o,s<=a&&a<=r)&&n.push(i[t]._templateVars)}return n}var a},_attachSkipButtons:function(t){let n=t.popup,s=t.target,e,a,o=n._container.getElementsByClassName("mapml-popup-content")[0];n._container.setAttribute("role","dialog"),o.setAttribute("tabindex","-1"),o.setAttribute("role","document"),n._count=0,n._source._eventParents?(e=n._source._eventParents[Object.keys(n._source._eventParents)[0]],a=n._source.group,_.call(n)):(p=n._source._layerEl.querySelector("map-extent")||n._source._layerEl.shadowRoot.querySelector("map-extent"),e=p._extentLayer,s.on("attachZoomLink",_,n)),n._container.querySelector('nav[class="mapml-focus-buttons"]')&&(L.DomUtil.remove(n._container.querySelector('nav[class="mapml-focus-buttons"]')),L.DomUtil.remove(n._container.querySelector("hr")));t=L.DomUtil.create("nav","mapml-focus-buttons");let i=L.DomUtil.create("button","mapml-popup-button",t);i.type="button",i.title="Focus Map",i.innerHTML="<span aria-hidden='true'>|&#10094;</span>",L.DomEvent.on(i,"click",t=>{L.DomEvent.stop(t),s.featureIndex._sortIndex(),s.closePopup(),s._container.focus()},n);let r=L.DomUtil.create("button","mapml-popup-button",t);r.type="button",r.title="Previous Feature",r.innerHTML="<span aria-hidden='true'>&#10094;</span>",L.DomEvent.on(r,"click",e._previousFeature,n);let l=L.DomUtil.create("p","mapml-feature-count",t),u=this._totalFeatureCount||1;l.innerText=n._count+1+"/"+u;let m=L.DomUtil.create("button","mapml-popup-button",t);m.type="button",m.title="Next Feature",m.innerHTML="<span aria-hidden='true'>&#10095;</span>",L.DomEvent.on(m,"click",e._nextFeature,n);let c=L.DomUtil.create("button","mapml-popup-button",t);c.type="button",c.title="Focus Controls",c.innerHTML="<span aria-hidden='true'>&#10095;|</span>",L.DomEvent.on(c,"click",t=>{s.featureIndex._sortIndex(),s.featureIndex.currentIndex=s.featureIndex.inBoundFeatures.length-1,s.featureIndex.inBoundFeatures[0]?.path.setAttribute("tabindex",-1),s.featureIndex.inBoundFeatures[s.featureIndex.currentIndex]?.path.setAttribute("tabindex",0),L.DomEvent.stop(t),s.closePopup(),s._controlContainer.querySelector("A:not([hidden])").focus()},n);var p=L.DomUtil.create("hr","mapml-popup-divider");function h(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var o=9===t.originalEvent.keyCode,i=t.originalEvent.shiftKey;(e[0].classList.contains("leaflet-popup-close-button")&&o&&!i||27===t.originalEvent.keyCode||e[0].classList.contains("leaflet-popup-close-button")&&13===t.originalEvent.keyCode||e[0].classList.contains("mapml-popup-content")&&o&&i||e[0]===n._content.querySelector("a")&&o&&i)&&setTimeout(()=>{s.closePopup(n),a.focus(),L.DomEvent.stop(t)},0)}function d(t){let e=t.originalEvent.path||t.originalEvent.composedPath();var o=9===t.originalEvent.keyCode,i=t.originalEvent.shiftKey;13===t.originalEvent.keyCode&&e[0].classList.contains("leaflet-popup-close-button")||27===t.originalEvent.keyCode?(L.DomEvent.stopPropagation(t),s.closePopup(n),s._container.focus(),27!==t.originalEvent.keyCode&&(s._popupClosed=!0)):o&&e[0].classList.contains("leaflet-popup-close-button")?s.closePopup(n):e[0].classList.contains("mapml-popup-content")&&o&&i?(s.closePopup(n),setTimeout(()=>{L.DomEvent.stop(t),s._container.focus()},0)):e[0]===n._content.querySelector("a")&&o&&i&&(s.closePopup(n),setTimeout(()=>{L.DomEvent.stop(t),s.getContainer.focus()},0))}function _(o){let i=this._content,n=o?o.currFeature:this._source._groupLayer._featureEl;if(i.querySelector("a.mapml-zoom-link")&&i.querySelector("a.mapml-zoom-link").remove(),n.querySelector("map-geometry")){var a=n.extent.topLeft.gcrs,o=n.extent.bottomRight.gcrs,o=L.latLngBounds(L.latLng(a.horizontal,a.vertical),L.latLng(o.horizontal,o.vertical)).getCenter(!0);let t=document.createElement("a");t.href=`#${n.getZoomToZoom()},${o.lng},`+o.lat,t.innerHTML=""+M.options.locale.popupZoom,t.className="mapml-zoom-link",t.onclick=t.onkeydown=function(t){(t instanceof MouseEvent||13===t.keyCode)&&(t.preventDefault(),n.zoomTo(),s.closePopup(),s.getContainer().focus())};let e=i.querySelector(".mapml-zoom-link");e&&e.remove(),i.insertBefore(t,i.querySelector("hr.mapml-popup-divider"))}}n._navigationBar=t,n._content.appendChild(p),n._content.appendChild(t),o.focus(),a&&!M.options.featureIndexOverlayOption?(a.setAttribute("aria-expanded","true"),s.on("keydown",h)):s.on("keydown",d),s.on("popupclose",function t(e){e.popup===n&&(s.off("keydown",h),s.off("keydown",d),s.off("popupopen",_),s.off("popupclose",t),a&&a.setAttribute("aria-expanded","false"))})}}),b=L.Layer.extend({onAdd:function(t){var e=t.getSize();(400<e.x||300<e.y)&&(this._container=L.DomUtil.create("table","mapml-debug",t._container),this._panel=v({className:"mapml-debug-panel",pane:this._container}),t.addLayer(this._panel)),this._grid=E({className:"mapml-debug-grid",pane:t._panes.mapPane,zIndex:400,tileSize:t.options.crs.options.crs.tile.bounds.max.x}),t.addLayer(this._grid),this._vectors=T({className:"mapml-debug-vectors",pane:t._panes.mapPane,toolPane:this._container}),t.addLayer(this._vectors)},onRemove:function(t){t.removeLayer(this._grid),t.removeLayer(this._vectors),this._panel&&(t.removeLayer(this._panel),L.DomUtil.remove(this._container))}}),x=L.Layer.extend({initialize:function(t){L.setOptions(this,t)},onAdd:function(t){this._title=L.DomUtil.create("caption","mapml-debug-banner",this.options.pane),this._title.innerHTML="Debug mode",t.debug={},t.debug._infoContainer=this._debugContainer=L.DomUtil.create("tbody","mapml-debug-panel",this.options.pane);var e=t.debug._infoContainer;t.debug._tileCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tileMatrixCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._mapCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._tcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._pcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),t.debug._gcrsCoord=L.DomUtil.create("tr","mapml-debug-coordinates",e),this._map.on("mousemove",this._updateCoords)},onRemove:function(){L.DomUtil.remove(this._title),this._debugContainer&&(L.DomUtil.remove(this._debugContainer),this._map.off("mousemove",this._updateCoords))},_updateCoords:function(r){if(!this.contextMenu._visible){let t=this.options.mapEl,e=t._map.project(r.latlng),o=t._map.options.crs.scale(+t.zoom),i=t._map.options.crs.transformation.untransform(e,o),n=t._map.options.crs.options.crs.tile.bounds.max.x,a=e.x%n,s=e.y%n;a<0&&(a+=n),s<0&&(s+=n),this.debug._tileCoord.innerHTML=`
      <th scope="row">tile: </th>
      <td>i: ${Math.trunc(a)}, </td>
      <td>j: ${Math.trunc(s)}</td>
      `,this.debug._mapCoord.innerHTML=`
      <th scope="row">map: </th>
      <td>i: ${Math.trunc(r.containerPoint.x)}, </td>
      <td>j: ${Math.trunc(r.containerPoint.y)}</td>
      `,this.debug._gcrsCoord.innerHTML=`
      <th scope="row">gcrs: </th>
      <td>lon: ${r.latlng.lng.toFixed(6)}, </td>
      <td>lat: ${r.latlng.lat.toFixed(6)}</td>
      `,this.debug._tcrsCoord.innerHTML=`
      <th scope="row">tcrs: </th>
      <td>x: ${Math.trunc(e.x)}, </td>
      <td>y: ${Math.trunc(e.y)}</td>
      `,this.debug._tileMatrixCoord.innerHTML=`
      <th scope="row">tilematrix: </th>
      <td>column: ${Math.trunc(e.x/n)}, </td>
      <td>row: ${Math.trunc(e.y/n)}</td>
      `,this.debug._pcrsCoord.innerHTML=`
      <th scope="row">pcrs: </th>
      <td>easting: ${i.x.toFixed(2)}, </td>
      <td>northing: ${i.y.toFixed(2)}</td>
      `}}}),v=function(t){return new x(t)},C=L.GridLayer.extend({initialize:function(t){L.setOptions(this,t),L.GridLayer.prototype.initialize.call(this,this._map)},createTile:function(t){let e=L.DomUtil.create("div","mapml-debug-tile");return e.setAttribute("col",t.x),e.setAttribute("row",t.y),e.setAttribute("zoom",t.z),e.innerHTML=["col: "+t.x,"row: "+t.y,"zoom: "+t.z].join(", "),e.style.outline="1px dashed red",e}}),E=function(t){return new C(t)},S=L.LayerGroup.extend({initialize:function(t){L.setOptions(this,t),L.LayerGroup.prototype.initialize.call(this,this._map,t)},onAdd:function(t){t.on("overlayremove",this._mapLayerUpdate,this),t.on("overlayadd",this._mapLayerUpdate,this);var e=t.options.crs.transformation.transform(L.point(0,0),t.options.crs.scale(0));this._centerVector=L.circle(t.options.crs.pointToLatLng(e,0),{radius:250,className:"mapml-debug-vectors projection-centre"}),this._centerVector.bindTooltip("Projection Center"),this._addBounds(t)},onRemove:function(t){this.clearLayers()},_addBounds:function(r){setTimeout(()=>{let t=Object.keys(r._layers),o=r._layers,i=["#FF5733","#8DFF33","#3397FF","#E433FF","#F3FF33"],n=0;this.addLayer(this._centerVector);for(var a of t)if(o[a].layerBounds||o[a].extentBounds){let t;t=o[a].layerBounds?[o[a].layerBounds.min,L.point(o[a].layerBounds.max.x,o[a].layerBounds.min.y),o[a].layerBounds.max,L.point(o[a].layerBounds.min.x,o[a].layerBounds.max.y)]:[o[a].extentBounds.min,L.point(o[a].extentBounds.max.x,o[a].extentBounds.min.y),o[a].extentBounds.max,L.point(o[a].extentBounds.min.x,o[a].extentBounds.max.y)];var s=o[a].extentBounds&&o[a].options.linkEl.getLayerEl().hasAttribute("data-testid")?o[a].options.linkEl.getLayerEl().getAttribute("data-testid"):o[a].layerBounds&&o[a].options?._leafletLayer?._layerEl.hasAttribute("data-testid")?o[a].options._leafletLayer._layerEl.getAttribute("data-testid"):"";let e=I(t,{className:this.options.className.concat(" ",s),color:i[n%i.length],weight:2,opacity:1,fillOpacity:.01,fill:!0});o[a].options._leafletLayer&&e.bindTooltip(o[a].options._leafletLayer._title,{sticky:!0}),this.addLayer(e),n++}var e;r.totalLayerBounds&&(e=[r.totalLayerBounds.min,L.point(r.totalLayerBounds.max.x,r.totalLayerBounds.min.y),r.totalLayerBounds.max,L.point(r.totalLayerBounds.min.x,r.totalLayerBounds.max.y)],e=I(e,{className:"mapml-debug-vectors mapml-total-bounds",color:"#808080",weight:5,opacity:.5,fill:!1}),this.addLayer(e))},0)},_mapLayerUpdate:function(t){this.clearLayers(),this._addBounds(t.target)}}),T=function(t){return new S(t)},A=L.Path.extend({getCenter:function(t){let e=this._map.options.crs;return e.unproject(L.bounds(this._locations).getCenter())},options:{className:"mapml-debug-extent"},initialize:function(t,e){this._locations=t,L.setOptions(this,e)},_project:function(){this._rings=[];let e=this._map.options.crs.scale(this._map.getZoom()),o=this._map;for(let t=0;t<this._locations.length;t++){var i=o.options.crs.transformation.transform(this._locations[t],e);this._rings.push(L.point(i.x,i.y)._subtract(o.getPixelOrigin()))}this._parts=[this._rings]},_update:function(){this._map&&this._renderer._updatePoly(this,!0)}}),I=function(t,e){return new A(t,e)},k=L.Handler.extend({addHooks:function(){L.setOptions(this,{mapEl:this._map.options.mapEl}),L.DomEvent.on(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},removeHooks:function(){L.DomEvent.off(this._map,"click",this._queryTopLayer,this),L.DomEvent.on(this._map,"keypress",this._queryTopLayerAtMapCenter,this)},_getTopQueryableLayer:function(){for(var t=this.options.mapEl.layers,e=t.length-1;0<=e;e--)if(t[e].queryable())return t[e]._layer},_queryTopLayerAtMapCenter:function(t){setTimeout(()=>{!this._map.isFocused||this._map._popupClosed||" "!==t.originalEvent.key&&13!=+t.originalEvent.keyCode?delete this._map._popupClosed:this._map.fire("click",{latlng:this._map.getCenter(),layerPoint:this._map.latLngToLayerPoint(this._map.getCenter()),containerPoint:this._map.latLngToContainerPoint(this._map.getCenter())})},0)},_queryTopLayer:function(t){var e=this._getTopQueryableLayer();e&&(e._mapmlFeatures&&delete e._mapmlFeatures,this._query(t,e))},_query(m,a){function e(t){return n.transformation.untransform(t,n.scale(i))}function o(t){return n.unproject(n.transformation.untransform(t,n.scale(i)),i)}var i=m.target.getZoom(),s=this._map,n=M[a.options.projection],r=s.options.crs.options.crs.tile.bounds.max.x,l=a._container,u={autoClose:!1,autoPan:!0,maxHeight:.5*s.getSize().y-50},c=n.latLngToPoint(m.latlng,i),p=c.divideBy(r).floor(),h=new L.Bounds(c.divideBy(r).floor().multiplyBy(r),c.divideBy(r).ceil().multiplyBy(r)),t=this._map.project(m.latlng),d=this._map.options.crs.scale(this._map.getZoom()),d=this._map.options.crs.transformation.untransform(t,d),_=a.getQueryTemplates(d,i);let y=[];for(let t=0;t<_.length;t++){var f,g={},b=_[t];for(f in g[b.query.tilei]=c.x.toFixed()-p.x*r,g[b.query.tilej]=c.y.toFixed()-p.y*r,g[b.query.mapi]=s.getSize().divideBy(2).x.toFixed(),g[b.query.mapj]=s.getSize().divideBy(2).y.toFixed(),g[b.query.pixelleft]=n.pointToLatLng(c,i).lng,g[b.query.pixeltop]=n.pointToLatLng(c,i).lat,g[b.query.pixelright]=n.pointToLatLng(c.add([1,1]),i).lng,g[b.query.pixelbottom]=n.pointToLatLng(c.add([1,1]),i).lat,g[b.query.column]=p.x,g[b.query.row]=p.y,g[b.query.x]=c.x.toFixed(),g[b.query.y]=c.y.toFixed(),g[b.query.easting]=e(c).x,g[b.query.northing]=e(c).y,g[b.query.longitude]=o(c).lng,g[b.query.latitude]=o(c).lat,g[b.query.zoom]=i,g[b.query.width]=s.getSize().x,g[b.query.height]=s.getSize().y,g[b.query.mapbottom]=e(c.add(s.getSize().divideBy(2))).y,g[b.query.mapleft]=e(c.subtract(s.getSize().divideBy(2))).x,g[b.query.maptop]=e(c.subtract(s.getSize().divideBy(2))).y,g[b.query.mapright]=e(c.add(s.getSize().divideBy(2))).x,g[b.query.tilebottom]=e(h.max).y,g[b.query.tileleft]=e(h.min).x,g[b.query.tiletop]=e(h.min).y,g[b.query.tileright]=e(h.max).x,b.query)["mapi","mapj","tilei","tilej","row","col","x","y","easting","northing","longitude","latitude","width","height","zoom","mapleft","mapright",",maptop","mapbottom","tileleft","tileright","tiletop","tilebottom","pixeltop","pixelbottom","pixelleft","pixelright"].indexOf(f)<0&&(g[f]=b.query[f]);y.push(function(t,e){const u=new DOMParser;return fetch(L.Util.template(t.template,e),{redirect:"follow"}).then(e=>{if(200<=e.status&&e.status<300)return e.text().then(t=>({contenttype:e.headers.get("Content-Type"),text:t}));throw new Error(e.status)}).then(i=>{let n=[],o=[];var a="<map-geometry cs='gcrs'><map-point><map-coordinates>"+m.latlng.lng+" "+m.latlng.lat+"</map-coordinates></map-point></map-geometry>";if(i.contenttype.startsWith("text/mapml")){let t=u.parseFromString(i.text,"application/xml");var s=t.querySelectorAll("map-feature:not(:has(map-geometry))");if(s.length){let o=u.parseFromString(a,"application/xml");for(let e=0;e<s.length;e++){let t=s[e];t.appendChild(o.firstElementChild.cloneNode(!0))}}n=Array.prototype.slice.call(t.querySelectorAll("map-feature")),o=Array.prototype.slice.call(t.querySelectorAll("map-meta[name=cs], map-meta[name=zoom], map-meta[name=projection]")),o.length&&n.forEach(t=>t.meta=o)}else try{let t=u.parseFromString(i.text,"application/xml");var r,l=t.querySelectorAll("map-feature");if(t.querySelector("parsererror")||0===l.length)throw new Error("parsererror");let e=u.parseFromString(a,"application/xml");o=Array.prototype.slice.call(t.querySelectorAll("map-meta[name=cs], map-meta[name=zoom], map-meta[name=projection]"));for(r of l)r.querySelector("map-geometry")||r.appendChild(e.firstElementChild.cloneNode(!0)),r.meta=o,n.push(r)}catch(t){let e=u.parseFromString(i.text,"text/html"),o=u.parseFromString("<map-feature><map-properties></map-properties>"+a+"</map-feature>","text/html");e.body?o.querySelector("map-properties").appendChild(e.querySelector("html")):o.querySelector("map-properties").append(i.text),n.push(o.querySelector("map-feature"))}return{features:n,template:t}}).catch(t=>{console.log("Looks like there was a problem. Status: "+t.message)})}(b,g))}Promise.allSettled(y).then(t=>{a._mapmlFeatures=[];for(var e of t)if("fulfilled"===e.status){for(var o of e.value.features)o._linkEl=e.value.template.linkEl;a._mapmlFeatures=a._mapmlFeatures.concat(e.value.features)}0<a._mapmlFeatures.length&&function(i,n){if(0!==i.length){let t=M.featureLayer(i,{renderer:M.featureRenderer(),pane:l,projection:s.options.projection,_leafletLayer:a,query:!0,mapEl:a.options.mapEl});t.addTo(a);let e=L.DomUtil.create("div","mapml-popup-content"),o=L.DomUtil.create("iframe");o.style="border: none",o.srcdoc=i[0].querySelector("map-feature map-properties").innerHTML,o.setAttribute("sandbox","allow-same-origin allow-forms"),e.appendChild(o),a._totalFeatureCount=i.length,a.bindPopup(e,u).openPopup(n),a.on("popupclose",function(){a.removeLayer(t)}),t.showPaginationFeature({i:0,popup:a._popup})}}(a._mapmlFeatures,m.latlng)})}}),P=L.Handler.extend({_touchstart:L.Browser.msPointer?"MSPointerDown":L.Browser.pointer?"pointerdown":"touchstart",initialize:function(t){L.Handler.prototype.initialize.call(this,t),this.activeIndex=0,this.excludedIndices=[4,7],this.isRunned=!1,this._menuItems={};this._menuItems.CTXBACK=0,this._menuItems.CTXFWD=1,this._menuItems.CTXRELOAD=2,this._menuItems.CTXFULLSCR=3,this._menuItems.CTXSPACER1=4,this._menuItems.CTXCOPY=5,this._menuItems.CTXPASTE=6,this._menuItems.CTXSPACER2=7,this._menuItems.CTXCNTRLS=8,this._menuItems.CTXDEBUG=9,this._menuItems.CTXVWSRC=10,this._items=[{text:M.options.locale.cmBack+" (<kbd>Alt+Left Arrow</kbd>)",callback:this._goBack},{text:M.options.locale.cmForward+" (<kbd>Alt+Right Arrow</kbd>)",callback:this._goForward},{text:M.options.locale.cmReload+" (<kbd>Ctrl+R</kbd>)",callback:this._reload},{text:M.options.locale.btnFullScreen+" (<kbd>F</kbd>)",callback:this._toggleFullScreen},{spacer:"-"},{text:M.options.locale.cmCopyCoords+" (<kbd>C</kbd>)<span></span>",callback:this._copyCoords,hideOnSelect:!1,popup:!0,submenu:[{text:M.options.locale.cmCopyMapML,callback:this._copyMapML},{text:M.options.locale.cmCopyExtent,callback:this._copyExtent},{text:M.options.locale.cmCopyLocation,callback:this._copyLocation}]},{text:M.options.locale.cmPasteLayer+" (<kbd>P</kbd>)",callback:this._paste},{spacer:"-"},{text:M.options.locale.cmToggleControls+" (<kbd>T</kbd>)",callback:this._toggleControls},{text:M.options.locale.cmToggleDebug+" (<kbd>D</kbd>)",callback:this._toggleDebug},{text:M.options.locale.cmViewSource+" (<kbd>V</kbd>)",callback:this._viewSource}],this.defExtCS=M.options.defaultExtCoor,this.defLocCS=M.options.defaultLocCoor;this._menuItems.LYRZOOMTO=0,this._menuItems.LYRCOPY=1,this._layerItems=[{text:M.options.locale.lmZoomToLayer+" (<kbd>Z</kbd>)",callback:this._zoomToLayer},{text:M.options.locale.lmCopyLayer+" (<kbd>L</kbd>)",callback:this._copyLayer}],this._extentLayerItems=[{text:M.options.locale.lmZoomToExtent+" (<kbd>Z</kbd>)",callback:this._zoomToMapExtent},{text:M.options.locale.lmCopyExtent+" (<kbd>L</kbd>)",callback:this._copyMapExtent}],this._mapMenuVisible=!1,this._keyboardEvent=!1,this._container=L.DomUtil.create("div","mapml-contextmenu",t.getContainer()),this._container.setAttribute("hidden",""),this._items[0].el=this._createItem(this._container,this._items[0]),this._items[1].el=this._createItem(this._container,this._items[1]),this._items[2].el=this._createItem(this._container,this._items[2]),this._items[3].el=this._createItem(this._container,this._items[3]),this._items[4].el=this._createItem(this._container,this._items[4]),this._items[5].el=this._createItem(this._container,this._items[5]),this._copySubMenu=L.DomUtil.create("div","mapml-contextmenu mapml-submenu",this._container),this._copySubMenu.id="mapml-copy-submenu",this._copySubMenu.setAttribute("hidden",""),this._clickEvent=null;this._menuItems.CPYMENUMAP=0,this._menuItems.CPYMENUEXTENT=1,this._menuItems.CPYMENULOC=2,this._createItem(this._copySubMenu,this._items[5].submenu[0],0),this._createItem(this._copySubMenu,this._items[5].submenu[1],1),this._createItem(this._copySubMenu,this._items[5].submenu[2],2),this._items[6].el=this._createItem(this._container,this._items[6]),this._items[7].el=this._createItem(this._container,this._items[7]),this._items[8].el=this._createItem(this._container,this._items[8]),this._items[9].el=this._createItem(this._container,this._items[9]),this._items[10].el=this._createItem(this._container,this._items[10]),this._layerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-layer-menu",t.getContainer()),this._layerMenu.setAttribute("hidden",""),this._createItem(this._layerMenu,this._layerItems[0]),this._createItem(this._layerMenu,this._layerItems[1]),this._extentLayerMenu=L.DomUtil.create("div","mapml-contextmenu mapml-extent-menu",t.getContainer()),this._extentLayerMenu.setAttribute("hidden",""),this._createItem(this._extentLayerMenu,this._extentLayerItems[0]),this._createItem(this._extentLayerMenu,this._extentLayerItems[1]),L.DomEvent.on(this._container,"click",L.DomEvent.stop).on(this._container,"mousedown",L.DomEvent.stop).on(this._container,"dblclick",L.DomEvent.stop).on(this._container,"contextmenu",L.DomEvent.stop).on(this._layerMenu,"click",L.DomEvent.stop).on(this._layerMenu,"mousedown",L.DomEvent.stop).on(this._layerMenu,"dblclick",L.DomEvent.stop).on(this._layerMenu,"contextmenu",L.DomEvent.stop).on(this._extentLayerMenu,"click",L.DomEvent.stop).on(this._extentLayerMenu,"mousedown",L.DomEvent.stop).on(this._extentLayerMenu,"dblclick",L.DomEvent.stop).on(this._extentLayerMenu,"contextmenu",L.DomEvent.stop),this.t=document.createElement("template"),this.t.innerHTML=`<map-feature zoom="">
        <map-featurecaption></map-featurecaption>
        <map-properties>
            <h2></h2>
            <div style="text-align:center"></div>
        </map-properties>
        <map-geometry cs="">
          <map-point>
            <map-coordinates></map-coordinates>
          </map-point>
        </map-geometry>
      </map-feature>`},addHooks:function(){var t=this._map.getContainer();L.DomEvent.on(t,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var t=this._map.getContainer();L.DomEvent.off(t,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),L.Browser.touch&&L.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,zoomstart:this._hide},this)},_updateCS:function(){this.defExtCS===M.options.defaultExtCoor&&this.defLocCS===M.options.defaultLocCoor||(this.defExtCS=M.options.defaultExtCoor,this.defLocCS=M.options.defaultLocCoor)},_copyExtent:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,o=e.defExtCS?e.defExtCS.toLowerCase():"pcrs",i=(t instanceof KeyboardEvent?this:this.options.mapEl).extent.topLeft[o],n=(t instanceof KeyboardEvent?this:this.options.mapEl).extent.bottomRight[o],a="";"pcrs"===o?a=`<map-meta name="extent" content="top-left-easting=${Math.round(i.horizontal)}, top-left-northing=${Math.round(i.vertical)}, bottom-right-easting=${Math.round(n.horizontal)}, bottom-right-northing=${Math.round(n.vertical)}"></map-meta>`:"gcrs"===o?a=`<map-meta name="extent" content="top-left-longitude=${i.horizontal}, top-left-latitude=${i.vertical}, bottom-right-longitude=${n.horizontal}, bottom-right-latitude=${n.vertical}"></map-meta>`:"tcrs"===o?a=`<map-meta name="extent" content="top-left-x=${i[0].horizontal}, top-left-y=${i[0].vertical}, bottom-right-x=${n[n.length-1].horizontal}, bottom-right-y=${n[n.length-1].vertical}"></map-meta>`:"tilematrix"===o?a=`<map-meta name="extent" content="top-left-column=${i[0].horizontal}, top-left-row=${i[0].vertical}, bottom-right-column=${n[n.length-1].horizontal}, bottom-right-row=${n[n.length-1].vertical}"></map-meta>`:console.log("not support"),e._copyData(a)},_zoomToLayer:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu;e._layerClicked.layer._layerEl.zoomTo()},_copyLayer:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,o=e._layerClicked.layer._layerEl;e._copyData(o.getOuterHTML())},_zoomToMapExtent:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu;e._layerClicked.extent.zoomTo()},_copyMapExtent:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,o=e._layerClicked.extent;e._copyData(o.getOuterHTML())},_goForward:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.forward()},_goBack:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.back()},_reload:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.reload()},_toggleFullScreen:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e._toggleFullScreen()},_toggleControls:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.controls?e.controls=!1:e.controls=!0},_copyMapML:function(t){let e=(t instanceof KeyboardEvent?this._map:this).contextMenu,o=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e._copyData(o.outerHTML.replace(/<div class="mapml-web-map">.*?<\/div>|<style>\[is="web-map"].*?<\/style>|<style>mapml-viewer.*?<\/style>/gm,""))},_paste:function(t){(t instanceof KeyboardEvent?this._map:this).contextMenu;let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;navigator.clipboard.readText().then(t=>{M._pasteLayer(e,t)})},_viewSource:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.viewSource()},_toggleDebug:function(t){let e=(t instanceof KeyboardEvent?this._map:this).options.mapEl;e.toggleDebug()},_copyCoords:function(t){let e=this.contextMenu||this;e._showCopySubMenu(t)},_copyData:function(t){const e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)},_copyLocation:function(t){const e=this.contextMenu;switch(e.defLocCS.toLowerCase()){case"tile":e._copyTile.call(this,t);break;case"tilematrix":e._copyTileMatrix.call(this,t);break;case"map":e._copyMap.call(this,t);break;case"tcrs":e._copyTCRS.call(this,t);break;case"pcrs":e._copyPCRS.call(this,t);break;default:e._copyGCRS.call(this,t)}},_copyGCRS:function(t){let e=this.options.mapEl,o=this.contextMenu._clickEvent,i=e.projection,n=this.contextMenu.t.content.firstElementChild.cloneNode(!0),a=n.querySelector("map-featurecaption"),s=n.querySelector("h2"),r=n.querySelector("div"),l=n.querySelector("map-geometry"),u=n.querySelector("map-coordinates");n.setAttribute("zoom",e.zoom),l.setAttribute("cs","gcrs"),a.textContent=`Copied ${i} gcrs location`,s.textContent=`Copied ${i} gcrs location`,r.textContent=o.latlng.lng.toFixed(6)+" "+o.latlng.lat.toFixed(6),u.textContent=o.latlng.lng.toFixed(6)+" "+o.latlng.lat.toFixed(6),this.contextMenu._copyData(n.outerHTML)},_copyTCRS:function(t){let e=this.options.mapEl,o=this.contextMenu._clickEvent,i=e._map.project(o.latlng),n=i.x.toFixed(),a=i.y.toFixed(),s=e.projection,r=this.contextMenu.t.content.firstElementChild.cloneNode(!0),l=r.querySelector("map-featurecaption"),u=r.querySelector("h2"),m=r.querySelector("div"),c=r.querySelector("map-geometry"),p=r.querySelector("map-coordinates");r.setAttribute("zoom",e.zoom),c.setAttribute("cs","tcrs"),l.textContent=`Copied ${s} tcrs location`,u.textContent=`Copied ${s} tcrs location`,m.textContent=n+" "+a,p.textContent=n+" "+a,this.contextMenu._copyData(r.outerHTML)},_copyTileMatrix:function(t){let e=this.options.mapEl,o=this.contextMenu._clickEvent,i=e._map.project(o.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=e.projection,s=this.contextMenu.t.content.firstElementChild.cloneNode(!0),r=s.querySelector("map-featurecaption"),l=s.querySelector("h2"),u=s.querySelector("div"),m=s.querySelector("map-geometry"),c=s.querySelector("map-coordinates");s.setAttribute("zoom",e.zoom),m.setAttribute("cs","gcrs"),r.textContent=`Copied ${a} tilematrix location (not implemented yet)`,l.textContent=`Copied ${a} tilematrix location (not implemented yet)`,u.textContent=Math.trunc(i.x/n)+" "+Math.trunc(i.y/n),c.textContent=o.latlng.lng.toFixed(6)+" "+o.latlng.lat.toFixed(6),this.contextMenu._copyData(s.outerHTML)},_copyPCRS:function(t){let e=this.options.mapEl,o=this.contextMenu._clickEvent,i=e._map.project(o.latlng),n=e._map.options.crs.scale(+e.zoom),a=e._map.options.crs.transformation.untransform(i,n).round(),s=e.projection,r=this.contextMenu.t.content.firstElementChild.cloneNode(!0),l=r.querySelector("map-featurecaption"),u=r.querySelector("h2"),m=r.querySelector("div"),c=r.querySelector("map-geometry"),p=r.querySelector("map-coordinates");r.setAttribute("zoom",e.zoom),c.setAttribute("cs","pcrs"),l.textContent=`Copied ${s} pcrs location`,u.textContent=`Copied ${s} pcrs location`,m.textContent=a.x+" "+a.y,p.textContent=a.x+" "+a.y,this.contextMenu._copyData(r.outerHTML)},_copyTile:function(t){let e=this.options.mapEl,o=this.contextMenu._clickEvent,i=e._map.project(o.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=i.x%n,s=i.y%n,r=L.point(a,s).trunc(),l=e.projection,u=this.contextMenu.t.content.firstElementChild.cloneNode(!0),m=u.querySelector("map-featurecaption"),c=u.querySelector("h2"),p=u.querySelector("div"),h=u.querySelector("map-geometry"),d=u.querySelector("map-coordinates");r.x<0&&(r.x+=n),r.y<0&&(r.y+=n),u.setAttribute("zoom",e.zoom),h.setAttribute("cs","gcrs"),m.textContent=`Copied ${l} tile location (not implemented yet)`,c.textContent=`Copied ${l} tile location (not implemented yet)`,p.textContent=r.x+" "+r.y,d.textContent=o.latlng.lng.toFixed(6)+" "+o.latlng.lat.toFixed(6),this.contextMenu._copyData(u.outerHTML)},_copyMap:function(t){let e=this.options.mapEl,o=this.contextMenu._clickEvent,i=o.containerPoint.trunc(),n=e.projection,a=this.contextMenu.t.content.firstElementChild.cloneNode(!0),s=a.querySelector("map-featurecaption"),r=a.querySelector("h2"),l=a.querySelector("div"),u=a.querySelector("map-geometry"),m=a.querySelector("map-coordinates");a.setAttribute("zoom",e.zoom),u.setAttribute("cs","gcrs"),s.textContent=`Copied ${n} map location (not implemented yet)`,r.textContent=`Copied ${n} map location (not implemented yet)`,l.textContent=i.x+" "+i.y,m.textContent=o.latlng.lng.toFixed(6)+" "+o.latlng.lat.toFixed(6),this.contextMenu._copyData(a.outerHTML)},_copyAllCoords:function(t){let e=this.options.mapEl,o=this.contextMenu._clickEvent,i=e._map.project(o.latlng),n=e._map.options.crs.options.crs.tile.bounds.max.x,a=i.x%n,s=i.y%n,r=e._map.options.crs.scale(+e.zoom),l=e._map.options.crs.transformation.untransform(i,r);var u=`z:${e.zoom}
`;u+=`tile: i:${Math.trunc(a)}, j:${Math.trunc(s)}
`,u+=`tilematrix: column:${Math.trunc(i.x/n)}, row:${Math.trunc(i.y/n)}
`,u+=`map: i:${Math.trunc(o.containerPoint.x)}, j:${Math.trunc(o.containerPoint.y)}
`,u+=`tcrs: x:${Math.trunc(i.x)}, y:${Math.trunc(i.y)}
`,u+=`pcrs: easting:${l.x.toFixed(2)}, northing:${l.y.toFixed(2)}
`,u+=`gcrs: lon :${o.latlng.lng.toFixed(6)}, lat:`+o.latlng.lat.toFixed(6),this.contextMenu._copyData(u)},_createItem:function(t,e,o){if(e.spacer)return this._createSeparator(t,o);t=this._insertElementAt("button","mapml-contextmenu-item",t,o),o=this._createEventHandler(t,e.callback,e.context,e.hideOnSelect);return t.innerHTML=""+e.text,t.setAttribute("type","button"),t.classList.add("mapml-button"),e.popup&&(t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-controls","mapml-copy-submenu")),L.DomEvent.on(t,"mouseover",this._onItemMouseOver,this).on(t,"mouseout",this._onItemMouseOut,this).on(t,"mousedown",L.DomEvent.stopPropagation).on(t,"click",o),L.Browser.touch&&L.DomEvent.on(t,this._touchstart,L.DomEvent.stopPropagation),L.Browser.pointer||L.DomEvent.on(t,"click",this._onItemMouseOut,this),{id:L.Util.stamp(t),el:t,callback:o}},_createSeparator:function(t,e){e=this._insertElementAt("div","mapml-contextmenu-separator",t,e);return{id:L.Util.stamp(e),el:e}},_createEventHandler:function(r,l,u,m){let c=this;return m=void 0===m||m,function(t){let e=c._map,o=c._showLocation.containerPoint,i=e.containerPointToLayerPoint(o),n=e.layerPointToLatLng(i),a=c._showLocation.relatedTarget,s={containerPoint:o,layerPoint:i,latlng:n,relatedTarget:a};m&&c._hide(),l&&l.call(u||e,s),c._map.fire("contextmenu.select",{contextmenu:c,el:r})}},_insertElementAt:function(t,e,o,i){let n,a=document.createElement(t);return a.className=e,void 0!==i&&(n=o.children[i]),n?o.insertBefore(a,n):o.appendChild(a),a},_show:function(e){if(!e.originalEvent.target.closest(".mapml-vector-container")){this._mapMenuVisible&&this._hide();let t=(this._clickEvent=e).originalEvent.target;if(t.closest("fieldset"))t=t.closest("fieldset"),"mapml-layer-item"===t.className?(t=t.querySelector("span"),this._layerMenu.removeAttribute("hidden"),this._showAtPoint(e.containerPoint,e,this._layerMenu)):"mapml-layer-extent"===t.className&&(t=t.querySelector("span"),this._extentLayerMenu.removeAttribute("hidden"),this._showAtPoint(e.containerPoint,e,this._extentLayerMenu)),this._layerClicked=t;else if(t.classList.contains("leaflet-container")||t.classList.contains("mapml-debug-extent")||"path"===t.tagName){var o=this._map.options.mapEl.layers;this._layerClicked=Array.from(o).find(t=>t.checked);let t=e.containerPoint;L.Browser.gecko&&(t=(i=this._map.getContainer(),o=i.getBoundingClientRect().width,i=i.getBoundingClientRect().height,{x:Number.parseInt(o/2),y:Number.parseInt(i/2)})),this._container.removeAttribute("hidden"),this._showAtPoint(t,e,this._container),this._updateCS()}var i,n;0!==e.originalEvent.button&&-1!==e.originalEvent.button||(this._keyboardEvent=!0,this._layerClicked.className.includes("mapml-layer-item")?(n=document.activeElement,this._elementInFocus=n.shadowRoot.activeElement,this._layerMenuTabs=1,this._layerMenu.firstChild.focus()):this._layerClicked.className.includes("mapml-extent-item")?(n=document.activeElement,this._elementInFocus=n.shadowRoot.activeElement,this._extentLayerMenuTabs=1,this._extentLayerMenu.firstChild.focus()):this._container.querySelectorAll("button:not([disabled])")[0].focus())}},_showAtPoint:function(t,e,o){var i;this._items.length&&(i=L.extend(e||{},{contextmenu:this}),this._showLocation={containerPoint:t},e&&e.relatedTarget&&(this._showLocation.relatedTarget=e.relatedTarget),this._setPosition(t,o),this._mapMenuVisible||(o.removeAttribute("hidden"),this._mapMenuVisible=!0),this._map.fire("contextmenu.show",i))},_hide:function(){this._mapMenuVisible&&(this._mapMenuVisible=!1,this._container.setAttribute("hidden",""),this._copySubMenu.setAttribute("hidden",""),this._layerMenu.setAttribute("hidden",""),this._extentLayerMenu.setAttribute("hidden",""),this._map.fire("contextmenu.hide",{contextmenu:this}),setTimeout(()=>this._map._container.focus(),0),this.activeIndex=0,this.isRunned=!1)},_setPosition:function(t,e){var o,i=this._map.getSize(),n=this._getElementSize(e);this._map.options.contextmenuAnchor&&(o=L.point(this._map.options.contextmenuAnchor),t=t.add(o)),(e._leaflet_pos=t).x+n.x>i.x?(e.style.left="auto",e.style.right=Math.min(Math.max(i.x-t.x,0),i.x-n.x-1)+"px"):(e.style.left=Math.max(t.x,0)+"px",e.style.right="auto"),t.y+n.y>i.y?(e.style.top="auto",e.style.bottom=Math.min(Math.max(i.y-t.y,0),i.y-n.y-1)+"px"):(e.style.top=Math.max(t.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(t){let e=this._size;return e&&!this._sizeChanged||(e={},t.style.left="-999999px",t.style.right="auto",e.x=t.offsetWidth,e.y=t.offsetHeight,t.style.left="auto",this._sizeChanged=!1),e},_focusOnLayerControl:function(){this._mapMenuVisible=!1,delete this._layerMenuTabs,delete this._extentLayerMenuTabs,this._layerMenu.setAttribute("hidden",""),this._extentLayerMenu.setAttribute("hidden",""),(this._elementInFocus||this._layerClicked.parentElement.firstChild).focus(),delete this._elementInFocus},_setActiveItem:function(o){if(null===document.activeElement.shadowRoot&&!0===this.noActiveEl&&(this.noActiveEl=!1,this._items[9].el.el.focus()),document.activeElement.shadowRoot.activeElement.innerHTML===this._items[o].el.el.innerHTML){let t=o+1;for(;this._items[t].el.el.disabled;)t++,t>=this._items.length&&(t=0);this._setActiveItem(t)}else if(this.excludedIndices.includes(o)){let t=o+1,e=o-1;for(;this.excludedIndices.includes(t)||this._items[t].el.el.disabled;)t++,t>=this._items.length&&(t=0);for(;this.excludedIndices.includes(e)||this._items[e].el.el.disabled;)e--,e<0&&(e=this._items.length-1);this.activeIndex<o?this._setActiveItem(t):this._setActiveItem(e)}else this._items[o].el.el.focus(),this.activeIndex=o},_onKeyDown:function(t){if(this._mapMenuVisible&&"Shift"!==t.key){if("Enter"!==t.code&&"Tab"!==t.code&&!t.code.startsWith("Arrow")||t.preventDefault(),"ArrowUp"===t.code||t.shiftKey&&"Tab"===t.code)if(this._copySubMenu.hasAttribute("hidden")||null!==document.activeElement.shadowRoot&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUMAP].innerHTML)if(this._copySubMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].innerHTML)if(this._copySubMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENULOC].innerHTML)if(this._layerMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._layerMenu.children[this._menuItems.LYRZOOMTO].innerHTML)if(this._layerMenu.hasAttribute("hidden"))if(this._extentLayerMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._extentLayerMenu.children[this._menuItems.LYRZOOMTO].innerHTML)if(this._extentLayerMenu.hasAttribute("hidden"))if(0<this.activeIndex){let t=this.activeIndex-1;for(;this._items[t].el.el.disabled;)t--,t<0&&(t=this._items.length-1);this._setActiveItem(t)}else this._setActiveItem(this._items.length-1);else this._extentLayerMenu.children[this._menuItems.LYRZOOMTO].focus();else this._extentLayerMenu.children[this._menuItems.LYRCOPY].focus();else this._layerMenu.children[this._menuItems.LYRZOOMTO].focus();else this._layerMenu.children[this._menuItems.LYRCOPY].focus();else this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].focus();else this._copySubMenu.children[this._menuItems.CPYMENUMAP].focus();else this._copySubMenu.children[this._menuItems.CPYMENULOC].focus();else if("ArrowDown"===t.code||"Tab"===t.code)if(this._copySubMenu.hasAttribute("hidden")||null!==document.activeElement.shadowRoot&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENULOC].innerHTML)if(this._copySubMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].innerHTML)if(this._copySubMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUMAP].innerHTML)if(this._layerMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._layerMenu.children[this._menuItems.LYRZOOMTO].innerHTML)if(this._layerMenu.hasAttribute("hidden"))if(this._extentLayerMenu.hasAttribute("hidden")||document.activeElement.shadowRoot.activeElement.innerHTML!==this._extentLayerMenu.children[this._menuItems.LYRZOOMTO].innerHTML)if(this._extentLayerMenu.hasAttribute("hidden"))if(this.activeIndex<this._items.length-1)if(this.isRunned||0!==this.activeIndex||this._items[this.activeIndex].el.el.disabled){let t=this.activeIndex+1;for(;this._items[t].el.el.disabled;)t++,t>=this._items.length&&(t=0);this._setActiveItem(t)}else this._setActiveItem(0),this.isRunned=!0;else{let t=0;for(;this._items[t].el.el.disabled;)t++,t>=this._items.length&&(t=0);this._setActiveItem(t)}else this._extentLayerMenu.children[this._menuItems.LYRZOOMTO].focus();else this._extentLayerMenu.children[this._menuItems.LYRCOPY].focus();else this._layerMenu.children[this._menuItems.LYRZOOMTO].focus();else this._layerMenu.children[this._menuItems.LYRCOPY].focus();else this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].focus();else this._copySubMenu.children[this._menuItems.CPYMENULOC].focus();else this._copySubMenu.children[this._menuItems.CPYMENUMAP].focus();else if("ArrowRight"===t.code)null!==document.activeElement.shadowRoot&&document.activeElement.shadowRoot.activeElement.innerHTML===this._items[this._menuItems.CTXCOPY].el.el.innerHTML&&this._copySubMenu.hasAttribute("hidden")?(this._showCopySubMenu(),this._copySubMenu.children[0].focus()):document.activeElement.shadowRoot.activeElement.innerHTML!==this._items[this._menuItems.CTXCOPY].el.el.innerHTML||this._copySubMenu.hasAttribute("hidden")||this._copySubMenu.children[0].focus();else if("ArrowLeft"===t.code)this._copySubMenu.hasAttribute("hidden")||null===document.activeElement.shadowRoot||document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUMAP].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENULOC].innerHTML||(this._copySubMenu.setAttribute("hidden",""),this._setActiveItem(this._menuItems.CTXCOPY));else if("Escape"===t.code){if(this._layerMenuTabs||this._extentLayerMenuTabs)return L.DomEvent.stop(t),void this._focusOnLayerControl();null===document.activeElement.shadowRoot||this._copySubMenu.hasAttribute("hidden")?this._hide():document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUMAP].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENUEXTENT].innerHTML&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._copySubMenu.children[this._menuItems.CPYMENULOC].innerHTML||(this._copySubMenu.setAttribute("hidden",""),this._setActiveItem(this._menuItems.CTXCOPY))}else"KeyC"!==t.code&&document.activeElement.shadowRoot.activeElement.innerHTML!==this._items[this._menuItems.CTXCOPY].el.el.innerHTML&&this._hide();switch(t.code){case"Enter":document.activeElement.shadowRoot.activeElement.innerHTML===this._items[this._menuItems.CTXCOPY].el.el.innerHTML?(this._copyCoords({latlng:this._map.getCenter()}),this._copySubMenu.firstChild.focus()):this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case"Space":this._map._container.parentNode.activeElement.parentNode.classList.contains("mapml-contextmenu")&&this._map._container.parentNode.activeElement.click();break;case"KeyC":this._copyCoords({latlng:this._map.getCenter()}),this._copySubMenu.firstChild.focus();break;case"KeyD":this._toggleDebug(t);break;case"KeyM":this._copyMapML(t);break;case"KeyL":this._layerClicked.className.includes("mapml-layer-item")?this._copyLayer(t):this._layerClicked.className.includes("mapml-extent-item")&&this._copyMapExtent(t);break;case"KeyF":this._toggleFullScreen(t);break;case"KeyP":this._paste(t);break;case"KeyT":this._toggleControls(t);break;case"KeyV":this._viewSource(t);break;case"KeyZ":this._layerClicked.className.includes("mapml-layer-item")?this._zoomToLayer(t):this._layerClicked.className.includes("mapml-extent-item")&&this._zoomToMapExtent(t)}}},_showCopySubMenu:function(t){let e=this._map.getSize(),o=this._clickEvent,i=this._copySubMenu,n=this._items[5].el.el;n.setAttribute("aria-expanded","true"),i.removeAttribute("hidden");var a=this._container.offsetWidth,s=(this._container.offsetHeight,i.offsetWidth);o.containerPoint.x+a+s>e.x?(i.style.left="auto",i.style.right=a+"px"):(i.style.left=a+"px",i.style.right="auto"),i.style.top="78px",i.style.bottom="auto"},_hideCopySubMenu:function(t){if(t.relatedTarget&&t.relatedTarget.parentElement&&!t.relatedTarget.parentElement.classList.contains("mapml-submenu")&&!t.relatedTarget.classList.contains("mapml-submenu")){let t=this._copySubMenu,e=this._items[4].el.el;e.setAttribute("aria-expanded","false"),t.setAttribute("hidden",""),this.noActiveEl=!0}},_onItemMouseOver:function(t){L.DomUtil.addClass(t.target||t.srcElement,"over"),t.srcElement.innerText===M.options.locale.cmCopyCoords+" (C)"&&this._showCopySubMenu(t)},_onItemMouseOut:function(t){L.DomUtil.removeClass(t.target||t.srcElement,"over"),this._hideCopySubMenu(t)},toggleContextMenuItem:function(t,e){t=t.toUpperCase(),"disabled"===e?"CONTROLS"===t?this._items[8].el.el.disabled=!0:"BACK"===t?this._items[0].el.el.disabled=!0:"FORWARD"===t?this._items[1].el.el.disabled=!0:"RELOAD"===t&&(this._items[2].el.el.disabled=!0):"enabled"===e&&("CONTROLS"===t?this._items[8].el.el.disabled=!1:"BACK"===t?this._items[0].el.el.disabled=!1:"FORWARD"===t?this._items[1].el.el.disabled=!1:"RELOAD"===t&&(this._items[2].el.el.disabled=!1))},setViewFullScreenInnerHTML:function(t){"view"===t?this._map.contextMenu._items[3].el.el.innerHTML=M.options.locale.btnFullScreen+" (<kbd>F</kbd>)":"exit"===t&&(this._map.contextMenu._items[3].el.el.innerHTML=M.options.locale.btnExitFullScreen+" (<kbd>F</kbd>)")}}),w=function(e,o,t){if(!e||!o)return{};let i=[],n=[],a=[],s=[],r=o.options.crs.tile.bounds.max.y;for(let t=0;t<o.options.resolutions.length;t++){var l=o.scale(t),u=o.transformation.transform(e.min,l),l=o.transformation.transform(e.max,l);i.push({horizontal:u.x,vertical:l.y}),n.push({horizontal:l.x,vertical:u.y}),a.push({horizontal:i[t].horizontal/r,vertical:i[t].vertical/r}),s.push({horizontal:n[t].horizontal/r,vertical:n[t].vertical/r})}var m=o.unproject(e.min),c=o.unproject(e.max),c={topLeft:{horizontal:m.lng,vertical:c.lat},bottomRight:{horizontal:c.lng,vertical:m.lat}},m={topLeft:{horizontal:e.min.x,vertical:e.max.y},bottomRight:{horizontal:e.max.x,vertical:e.min.y}};let p={topLeft:{tcrs:i,tilematrix:a,gcrs:c.topLeft,pcrs:m.topLeft},bottomRight:{tcrs:n,tilematrix:s,gcrs:c.bottomRight,pcrs:m.bottomRight}};return t&&(p.projection=t),p},z=function(t,e){switch(e.toUpperCase()){case"PCRS":return L.bounds(L.point(t.topLeft.pcrs.horizontal,t.topLeft.pcrs.vertical),L.point(t.bottomRight.pcrs.horizontal,t.bottomRight.pcrs.vertical));case"GCRS":return L.latLngBounds(L.latLng(t.topLeft.gcrs.vertical,t.topLeft.gcrs.horizontal),L.latLng(t.bottomRight.gcrs.vertical,t.bottomRight.gcrs.horizontal))}},B=function(t){try{switch(t.toLowerCase()){case"row":case"column":return"TILEMATRIX";case"i":case"j":return["MAP","TILE"];case"x":case"y":return"TCRS";case"latitude":case"longitude":return"GCRS";case"northing":case"easting":return"PCRS";default:return M.FALLBACK_CS}}catch(t){return}},R=function(t){try{switch(t.toLowerCase()){case"tilematrix":return["column","row"];case"map":case"tile":return["i","j"];case"tcrs":return["x","y"];case"gcrs":return["longitude","latitude"];case"pcrs":return["easting","northing"]}}catch(t){return}},N=function(t){try{switch(t.toLowerCase()){case"i":case"column":case"longitude":case"x":case"easting":return"x";case"row":case"j":case"latitude":case"y":case"northing":return"y";default:return}}catch(t){return}},F=function(t,e,o,i){if(t&&(e||0===e)&&Number.isFinite(+e)&&o&&i)switch(o="string"==typeof o?M[o]:o,i.toUpperCase()){case"PCRS":return t;case"TCRS":case"TILEMATRIX":var n=o.transformation.transform(t.min,o.scale(+e)),a=o.transformation.transform(t.max,o.scale(+e));if("TCRS"===i.toUpperCase())return L.bounds(n,a);var s=o.options.crs.tile.bounds.max.x;return L.bounds(L.point(n.x/s,n.y/s),L.point(a.x/s,a.y/s));case"GCRS":a=o.unproject(t.min),s=o.unproject(t.max);return L.bounds(L.point(a.lng,a.lat),L.point(s.lng,s.lat));default:return}},O=function(t,e,o,i){if(t&&(void 0===e||Number.isFinite(+e))&&(void 0!==e||"TILEMATRIX"!==i&&"TCRS"!==i&&"TILE"!==i)&&i&&o){var n=(o="string"==typeof o?M[o]:o).options.crs.tile.bounds.max.x;switch(i.toUpperCase()){case"TILEMATRIX":return M.pixelToPCRSPoint(L.point(t.x*n,t.y*n),e,o);case"PCRS":return t;case"TCRS":return M.pixelToPCRSPoint(t,e,o);case"GCRS":return o.project(L.latLng(t.y,t.x));default:return}}},D=function(t,e,o){if(t&&(e||0===e)&&Number.isFinite(+e)&&o)return(o="string"==typeof o?M[o]:o).transformation.untransform(t,o.scale(e))},q=function(t,e,o,i){if(t&&t.max&&t.min&&(void 0===e||Number.isFinite(+e))&&(void 0!==e||"TILEMATRIX"!==i&&"TCRS"!==i&&"TILE"!==i)&&o&&i)return o="string"==typeof o?M[o]:o,L.bounds(M.pointToPCRSPoint(t.min,e,o,i),M.pointToPCRSPoint(t.max,e,o,i))},Z=function(t,e,o){if(t&&t.max&&t.min&&(e||0===e)&&Number.isFinite(+e)&&o)return o="string"==typeof o?M[o]:o,L.bounds(M.pixelToPCRSPoint(t.min,e,o),M.pixelToPCRSPoint(t.max,e,o))},U=function(t){if(!t||t instanceof Object)return{};let e=t.split(/\s+/).join(""),o={},i=e.split(",");for(let t=0;t<i.length;t++){var n=i[t].split("=");2===n.length&&(o[n[0]]=n[1])}return""!==o&&1===i[0].split("=").length&&(o.content=i[0]),o},H=function(t){for(var e=1,o=[],i=t.split(",");e<i.length;e+=2)o.push([parseInt(i[e-1]),parseInt(i[e])]);return o},j=function(t,e,o){var i=[];t.split(/\s+/gim).forEach(M._parseNumber,i),this.push(i)},G=function(t,e,o){this.push(parseFloat(t))},$=function(o,t){let i,n=!1,e,a=t._map,s;if("text/html"===o.type&&"_blank"!==o.target)o.target="_top";else if("text/html"!==o.type&&o.url.includes("#")){let t=o.url.split("#"),e=t[1].split(",");i={z:e[0]||0,lng:e[1]||0,lat:e[2]||0},n=!t[0],["/",".","#"].includes(o.url[0])&&(o.target="_self")}if(n)i&&!o.inPlace&&n&&(t._map.options.mapEl.zoomTo(+i.lat,+i.lng,+i.z),s&&(e.opacity=s),a.getContainer().focus());else switch(e=document.createElement("layer-"),e.setAttribute("src",o.url),e.setAttribute("checked",""),o.target){case"_blank":"text/html"===o.type?window.open(o.url):(l(),a.options.mapEl.appendChild(e));break;case"_parent":l();for(var r of a.options.mapEl.querySelectorAll("layer-"))r._layer!==t&&a.options.mapEl.removeChild(r);a.options.mapEl.appendChild(e),a.options.mapEl.removeChild(t._layerEl);break;case"_top":window.location.href=o.url;break;default:l(),s=t._layerEl.opacity,t._layerEl.insertAdjacentElement("beforebegin",e),a.options.mapEl.removeChild(t._layerEl)}function l(){var t;!o.inPlace&&i&&(t=i,a.options.mapEl.lat=+t.lat,a.options.mapEl.lon=+t.lng,a.options.mapEl.zoom=+t.z),e.whenReady().then(()=>{!o.inPlace&&i?e.parentElement.zoomTo(+i.lat,+i.lng,+i.z):o.inPlace||e.zoomTo(),s&&(e.opacity=s),a.getContainer().focus()})}},Y=function(t){if(!t)return null;let o,i=t instanceof ShadowRoot?":host":":scope",n=t.querySelector(i+" > map-meta[name=projection]")&&M._metaContentToObject(t.querySelector(i+" > map-meta[name=projection]").getAttribute("content")).content.toUpperCase()||M.FALLBACK_PROJECTION;try{var a=t.querySelector(i+" > map-meta[name=extent]")&&M._metaContentToObject(t.querySelector(i+" > map-meta[name=extent]").getAttribute("content")),s=a.zoom;let e=Object.keys(a);for(let t=0;t<e.length;t++)if(!e[t].includes("zoom")){o=M.axisToCS(e[t].split("-")[2]);break}if(void 0===o)throw new Error("cs undefined when getting bounds");if(void 0===s&&("TILEMATRIX"===o||"TCRS"===o||"TILE"===o))throw new Error("map-meta[name=extent] zoom= parameter not provided for tcrs,tile or tilematrix bounds");var r=M.csToAxes(o);return M.boundsToPCRSBounds(L.bounds(L.point(+a["top-left-"+r[0]],+a["top-left-"+r[1]]),L.point(+a["bottom-right-"+r[0]],+a["bottom-right-"+r[1]])),s,n,o)}catch(t){return M.boundsToPCRSBounds(M[n].options.crs.tilematrix.bounds(0),0,n,o)}},V=function(t){if(!t)return null;var e=t instanceof ShadowRoot?":host":":scope",e=M._metaContentToObject(t.querySelector(e+"> map-meta[name=zoom]").getAttribute("content"));return e.min&&e.max&&e.value?{minZoom:+e.min,maxZoom:+e.max,minNativeZoom:+e.value,maxNativeZoom:+e.value}:e.min&&e.max?{minZoom:+e.min,maxZoom:+e.max}:e.min?{minZoom:+e.min}:e.max?{maxZoom:+e.max}:void 0},K=function(t,o){if(!t)return null;let i=100,n=0,a=t.querySelectorAll("map-feature"),e,s;for(let e=0;e<a.length;e++){let t=+a[e].getAttribute("zoom");a[e].getAttribute("zoom")||(t=o),n=Math.max(n,t),i=Math.min(i,t)}try{s=M._metaContentToObject(t.querySelector("map-meta[name=projection]").getAttribute("content")).content,e=M._metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content"))}catch(t){return{minZoom:0,maxZoom:M[s||M.FALLBACK_PROJECTION].options.resolutions.length-1,minNativeZoom:i,maxNativeZoom:n}}return{minZoom:+e.min,maxZoom:+e.max,minNativeZoom:i,maxNativeZoom:n}},W=function(e){let o,i;if(e.length&&e[0].parentElement.parentElement&&"mapml-"===e[0].parentElement.parentElement.tagName){let t=e[0].parentElement.parentElement;o=t.querySelector&&t.querySelector("map-meta[name=zoom]")&&+M._metaContentToObject(t.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,i=t.querySelector&&t.querySelector("map-meta[name=cs]")&&M._metaContentToObject(t.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS"}else o=e.querySelector&&e.querySelector("map-meta[name=zoom]")&&+M._metaContentToObject(e.querySelector("map-meta[name=zoom]").getAttribute("content")).value||0,i=e.querySelector&&e.querySelector("map-meta[name=cs]")&&M._metaContentToObject(e.querySelector("map-meta[name=cs]").getAttribute("content")).content||"GCRS";return{zoom:o,cs:i}},X=function(t){var e=t._map.project(t._map.getCenter()),t=t._map.options.crs.options.crs.tile.bounds.max.y;return[Math.trunc(e.x/t),Math.trunc(e.y/t)]},J=function(e,o){try{new URL(o);let t='<layer- src="'+o+'" label="'+M.options.locale.dfLayer+'" checked=""></layer->';e.insertAdjacentHTML("beforeend",t),e.lastElementChild.whenReady().catch(()=>{e&&e.removeChild(e.lastChild),t=null})}catch(t){if("<layer-"===(o=o.replace(/(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g,"").trim()).slice(0,7)&&"</layer->"===o.slice(-9))e.insertAdjacentHTML("beforeend",o);else if("<map-feature"===o.slice(0,12)&&"</map-feature>"===o.slice(-14)){var i=`<layer- label="${M.options.locale.dfPastedLayer}" checked>
                       <map-meta name='projection' content='${e.projection}'></map-meta>`+o+"</layer->";e.insertAdjacentHTML("beforeend",i)}else try{e.geojson2mapml(JSON.parse(o))}catch{console.log("Invalid Input!")}}},Q=function(i){let t=document.createElement("table"),e=t.createTHead(),o=e.insertRow(),n=document.createElement("th"),a=document.createElement("th");n.appendChild(document.createTextNode("Property name")),a.appendChild(document.createTextNode("Property value")),n.setAttribute("role","columnheader"),a.setAttribute("role","columnheader"),n.setAttribute("scope","col"),a.setAttribute("scope","col"),o.appendChild(n),o.appendChild(a);let s=t.createTBody();for(var r in i)if(i.hasOwnProperty(r)){let t=s.insertRow(),e=document.createElement("th"),o=document.createElement("td");e.appendChild(document.createTextNode(r)),o.appendChild(document.createTextNode(i[r])),e.setAttribute("scope","row"),o.setAttribute("itemprop",r),t.appendChild(e),t.appendChild(o)}return t},tt=function(t,e,o){return t==={}||(t[0]=Math.min(e,t[0]),t[1]=Math.min(o,t[1]),t[2]=Math.max(e,t[2]),t[3]=Math.max(o,t[3])),t},et=function(u,m={},c=null,p={}){m=Object.assign({},{label:null,projection:"OSMTILE",caption:null,properties:null,geometryFunction:null},m);var h=(u="string"==typeof u?JSON.parse(u):u).type.toUpperCase();let d="",t=!1,e=new DOMParser;null===c&&(u.bbox||(t=!0),a="<layer- label='' checked><map-meta name='projection' content='"+m.projection+"'></map-meta><map-meta name='cs' content='gcrs'></map-meta></layer->",c=e.parseFromString(a,"text/html"),null!==m.label?c.querySelector("layer-").setAttribute("label",m.label):u.name?c.querySelector("layer-").setAttribute("label",u.name):u.title?c.querySelector("layer-").setAttribute("label",u.title):c.querySelector("layer-").setAttribute("label",M.options.locale.dfLayer));let _="<map-point></map-point>";_=e.parseFromString("<map-point></map-point>","text/html");let y="<map-multipoint><map-coordinates></map-coordinates></map-multipoint>";y=e.parseFromString("<map-multipoint><map-coordinates></map-coordinates></map-multipoint>","text/html");let f="<map-linestring><map-coordinates></map-coordinates></map-linestring>";f=e.parseFromString("<map-linestring><map-coordinates></map-coordinates></map-linestring>","text/html");let g="<map-multilinestring></map-multilinestring>";g=e.parseFromString("<map-multilinestring></map-multilinestring>","text/html");let b="<map-polygon></map-polygon>";b=e.parseFromString("<map-polygon></map-polygon>","text/html");let x="<map-multipolygon></map-multipolygon>";x=e.parseFromString("<map-multipolygon></map-multipolygon>","text/html");let L="<map-geometrycollection></map-geometrycollection>";L=e.parseFromString("<map-geometrycollection></map-geometrycollection>","text/html");let n="<map-feature><map-featurecaption></map-featurecaption><map-geometry></map-geometry><map-properties></map-properties></map-feature>";n=e.parseFromString("<map-feature><map-featurecaption></map-featurecaption><map-geometry></map-geometry><map-properties></map-properties></map-feature>","text/html");let v="<map-coordinates></map-coordinates>";if(v=e.parseFromString("<map-coordinates></map-coordinates>","text/html"),"FEATURECOLLECTION"===h){u.bbox?c.querySelector("layer-").insertAdjacentHTML("afterbegin","<map-meta name='extent' content='top-left-longitude="+u.bbox[0]+", top-left-latitude="+u.bbox[1]+", bottom-right-longitude="+u.bbox[2]+",bottom-right-latitude="+u.bbox[3]+"'></map-meta>"):p=[1/0,1/0,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];var o=u.features;for(let t=0;t<o.length;t++)M.geojson2mapml(o[t],m,c,p)}else if("FEATURE"===h){let t=n.cloneNode(!0),e=t.querySelector("map-feature");u.bbox?c.querySelector("layer-").insertAdjacentHTML("afterbegin","<map-meta name='extent' content='top-left-longitude="+u.bbox[0]+", top-left-latitude="+u.bbox[1]+", bottom-right-longitude="+u.bbox[2]+",bottom-right-latitude="+u.bbox[3]+"'></map-meta>"):"object"==typeof p&&void 0===p.length&&(p=[1/0,1/0,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY]);let o=c.querySelector("layer-").getAttribute("label");"function"==typeof m.caption?o=m.caption(u):"string"==typeof m.caption?(o=u.properties[m.caption],void 0===o&&(o=m.caption)):u.id&&(o=u.id),e.querySelector("map-featurecaption").innerHTML=o;let i;"function"==typeof m.properties?(i=m.properties(u),i instanceof Element||(i=!1,console.error("options.properties function returns a string instead of an HTMLElement."))):i="string"==typeof m.properties?(e.querySelector("map-properties").insertAdjacentHTML("beforeend",m.properties),!1):m.properties instanceof HTMLElement?m.properties:M._properties2Table(u.properties),i&&e.querySelector("map-properties").appendChild(i);var a=M.geojson2mapml(u.geometry,m,c,p);"function"==typeof m.geometryFunction?e.querySelector("map-geometry").appendChild(m.geometryFunction(a,u)):e.querySelector("map-geometry").appendChild(a),c.querySelector("layer-").appendChild(e)}else if(["POINT","LINESTRING","POLYGON","MULTIPOINT","MULTILINESTRING","MULTIPOLYGON","GEOMETRYCOLLECTION"].includes(h))switch(h){case"POINT":p=M._updateExtent(p,u.coordinates[0],u.coordinates[1]),d=u.coordinates[0]+" "+u.coordinates[1];let t=_.cloneNode(!0);t=t.querySelector("map-point");let e=v.cloneNode(!0);return e=e.querySelector("map-coordinates"),e.innerHTML=d,t.appendChild(e),t;case"LINESTRING":let o=f.cloneNode(!0),i=o.querySelector("map-coordinates");d="";for(let t=0;t<u.coordinates.length;t++)p=M._updateExtent(p,u.coordinates[t][0],u.coordinates[t][1]),d=d+u.coordinates[t][0]+" "+u.coordinates[t][1]+" ";return i.innerHTML=d,o.querySelector("map-linestring");case"POLYGON":let n=b.cloneNode(!0);n=n.querySelector("map-polygon");for(let o=0;o<u.coordinates.length;o++){let e="",t=v.cloneNode(!0);t=t.querySelector("map-coordinates");for(let t=0;t<u.coordinates[o].length;t++)p=M._updateExtent(p,u.coordinates[o][t][0],u.coordinates[o][t][1]),e=e+u.coordinates[o][t][0]+" "+u.coordinates[o][t][1]+" ";t.innerHTML=e,n.appendChild(t)}return n;case"MULTIPOINT":d="";let a=y.cloneNode(!0);a=a.querySelector("map-multipoint");for(let t=0;t<u.coordinates.length;t++)p=M._updateExtent(p,u.coordinates[t][0],u.coordinates[t][1]),d=d+u.coordinates[t][0]+" "+u.coordinates[t][1]+" ";return a.querySelector("map-coordinates").innerHTML=d,a;case"MULTILINESTRING":let s=g.cloneNode(!0);s=s.querySelector("map-multilinestring");for(let o=0;o<u.coordinates.length;o++){let e="",t=v.cloneNode(!0);t=t.querySelector("map-coordinates");for(let t=0;t<u.coordinates[o].length;t++)p=M._updateExtent(p,u.coordinates[o][t][0],u.coordinates[o][t][1]),e=e+u.coordinates[o][t][0]+" "+u.coordinates[o][t][1]+" ";t.innerHTML=e,s.appendChild(t)}return s;case"MULTIPOLYGON":let r=x.cloneNode(!0);r=r.querySelector("map-multiPolygon");for(let n=0;n<u.coordinates.length;n++){let i=b.cloneNode(!0);i=i.querySelector("map-polygon");for(let o=0;o<u.coordinates[n].length;o++){let e="",t=v.cloneNode(!0);t=t.querySelector("map-coordinates");for(let t=0;t<u.coordinates[n][o].length;t++)p=M._updateExtent(p,u.coordinates[n][o][t][0],u.coordinates[n][o][t][1]),e=e+u.coordinates[n][o][t][0]+" "+u.coordinates[n][o][t][1]+" ";t.innerHTML=e,i.appendChild(t)}r.appendChild(i)}return r;case"GEOMETRYCOLLECTION":let l=L.cloneNode(!0);l=l.querySelector("map-geometrycollection");for(let t=0;t<u.geometries.length;t++){var C=M.geojson2mapml(u.geometries[t],m,c,p);l.appendChild(C)}return l}return t&&c.querySelector("layer-").insertAdjacentHTML("afterbegin","<map-meta name='extent' content='top-left-longitude="+p[0]+", top-left-latitude="+p[1]+", bottom-right-longitude="+p[2]+",bottom-right-latitude="+p[3]+"'></map-meta>"),c.querySelector("layer-")},ot=function(e){let o=[];e=e.filter(t=>!/[^\d.-]/g.test(t)).filter(t=>t);for(let t=0;t<e.length;t+=2)o.push(e.slice(t,t+2).map(Number));return o},it=function(t){null!==t.querySelector("thead")&&t.querySelector("thead").remove();let e={};return t.querySelectorAll("tr").forEach(t=>{t=t.querySelectorAll("th, td");e[t[0].innerHTML]=t[1].innerHTML}),e},nt=function(t,n,a,s){for(;"MAP-SPAN"===t.nodeName.toUpperCase()||"MAP-A"===t.nodeName.toUpperCase();)t=t.firstElementChild;let r=t.nodeName,l={},u;switch(r.toUpperCase()){case"MAP-POINT":var m;l.type="Point",s?(m=proj4.transform(n,a,t.querySelector("map-coordinates").innerHTML.split(/[<>\ ]/g).map(Number)),l.coordinates=[m.x,m.y]):l.coordinates=t.querySelector("map-coordinates").innerHTML.split(/[<>\ ]/g).map(Number);break;case"MAP-LINESTRING":l.type="LineString",u=t.querySelector("map-coordinates").innerHTML.split(/[<>\ ]/g),u=M._breakArray(u),s&&(u=M._pcrsToGcrs(u,n,a)),l.coordinates=u;break;case"MAP-POLYGON":l.type="Polygon",l.coordinates=[];let e=0;t.querySelectorAll("map-coordinates").forEach(t=>{t=t.innerHTML.split(/[<>\ ]/g),t=M._breakArray(t),s&&(t=M._pcrsToGcrs(t,n,a)),l.coordinates[e]=t,e++});break;case"MAP-MULTIPOINT":l.type="MultiPoint",u=M._breakArray(t.querySelector("map-coordinates").innerHTML.split(/[<>\ ]/g)),s&&(u=M._pcrsToGcrs(u,n,a)),l.coordinates=u;break;case"MAP-MULTILINESTRING":l.type="MultiLineString",l.coordinates=[];let o=0;t.querySelectorAll("map-coordinates").forEach(t=>{t=t.innerHTML.split(/[<>\ ]/g),t=M._breakArray(t),s&&(t=M._pcrsToGcrs(t,n,a)),l.coordinates[o]=t,o++});break;case"MAP-MULTIPOLYGON":l.type="MultiPolygon",l.coordinates=[];let i=0;t.querySelectorAll("map-polygon").forEach(t=>{let e=0;l.coordinates.push([]),t.querySelectorAll("map-coordinates").forEach(t=>{t=t.innerHTML.split(/[<>\ ]/g),t=M._breakArray(t),s&&(t=M._pcrsToGcrs(t,n,a)),l.coordinates[i].push([]),l.coordinates[i][e]=t,e++}),i++})}return l},at=function(e,o,i){let n=[];for(let t=0;t<e.length;t++){var a=[(a=proj4.transform(o,i,e[t])).x,a.y];n.push(a)}return n},st=function(t,i={}){i=Object.assign({},{propertyFunction:null,transform:!0},i);let n={type:"FeatureCollection"};n.title=t.getAttribute("label"),n.features=[];let a=null,s=null;i.transform&&(a=new proj4.Proj(t.parentElement._map.options.crs.code),s=new proj4.Proj("EPSG:4326"),"EPSG:3857"!==t.parentElement._map.options.crs.code&&"EPSG:4326"!==t.parentElement._map.options.crs.code||(i.transform=!1));let e=t.querySelectorAll("map-meta");e.forEach(e=>{if("extent"===e.getAttribute("name")){let t=e.getAttribute("content"),o=t.split(","),i={};for(let e=0;e<o.length;e++){let t=o[e].split("=");t[0]=t[0].trim(),t[1]=parseFloat(t[1]),i[t[0]]=t[1]}n.bbox=[i["top-left-longitude"],i["top-left-latitude"],i["bottom-right-longitude"],i["bottom-right-latitude"]]}});let o=t.querySelectorAll("map-feature"),r=0;return o.forEach(t=>{var e;n.features[r]={type:"Feature"},n.features[r].geometry={},n.features[r].properties={},t.querySelector("map-properties")?"function"==typeof i.propertyFunction?(e=i.propertyFunction(t.querySelector("map-properties")),n.features[r].properties=e):null!==t.querySelector("map-properties").querySelector("table")?(e=t.querySelector("map-properties").querySelector("table").cloneNode(!0),e=M._table2properties(e),n.features[r].properties=e):n.features[r].properties={prop0:t.querySelector("map-properties").innerHTML.replace(/(<([^>]+)>)/gi,"")}:n.features[r].properties=null;let o=t.querySelector("map-geometry").firstElementChild;for(;"MAP-SPAN"===o.nodeName.toUpperCase()||"MAP-A"===o.nodeName.toUpperCase();)o=o.firstElementChild;"MAP-GEOMETRYCOLLECTION"!==o.nodeName.toUpperCase()?n.features[r].geometry=M._geometry2geojson(o,a,s,i.transform):(n.features[r].geometry.type="GeometryCollection",n.features[r].geometry.geometries=[],t=o.children,Array.from(t).forEach(t=>{var e=t.nodeName.toUpperCase();"MAP-SPAN"===e||"MAP-A"===e?([...(t=t.cloneNode(!0)).querySelectorAll("map-a, map-span")].forEach(t=>t.replaceWith(...t.children)),Array.from(t.children).forEach(t=>{t=M._geometry2geojson(t,a,s,i.transform),n.features[r].geometry.geometries.push(t)})):(t=M._geometry2geojson(t,a,s,i.transform),n.features[r].geometry.geometries.push(t))})),r++}),n},rt=function(a,s,r,l){if(a){let t=s.getZoom(),e=s.options.crs.scale(t),o=s.options.crs.transformation.transform(a.getCenter(!0),e);var u=s.getSize().divideBy(2),m=o.subtract(u).round(),c=o.add(u).round(),p=M.pixelToPCRSPoint(m,t,s.options.projection),h=M.pixelToPCRSPoint(c,t,s.options.projection);let i=L.bounds(p,h),n=i.contains(a)?1:-1;for(;-1==n&&!i.contains(a)&&t-1>=r||1==n&&i.contains(a)&&t+1<=l;)t+=n,e=s.options.crs.scale(t),o=s.options.crs.transformation.transform(a.getCenter(!0),e),m=o.subtract(u).round(),c=o.add(u).round(),p=M.pixelToPCRSPoint(m,t,s.options.projection),h=M.pixelToPCRSPoint(c,t,s.options.projection),i=L.bounds(p,h);return 1==n&&0<=t-1&&(t!==l||!i.contains(a))&&t--,t}},lt=function(t,e){return t?t instanceof ShadowRoot?M.getClosest(t.host,e):t instanceof HTMLElement&&t.matches(e)?t:M.getClosest(t.parentNode,e):null},ut=L.Control.Attribution.extend({options:{prefix:'<img src="https://www.w3.org/community/src/templates/wordpress/StoryTeller/favicon.ico" style="position: relative; top: 5px" alt="W3C Community and Business Groups logo"> <a href="https://www.w3.org/community/maps4html/">Maps for HTML Community Group</a> | <img src="" style="padding-right: 0.3em;" alt="Slava Ukraini"> <a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a> '},onAdd:function(t){for(var e in(t.attributionControl=this)._container=L.DomUtil.create("details","leaflet-control-attribution"),L.DomEvent.disableClickPropagation(this._container),t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());this._update(),t.on("layeradd",this._addAttribution,this);let o=document.createElement("dialog");return o.setAttribute("class","shortcuts-dialog"),o.setAttribute("autofocus",""),o.onclick=function(t){t.stopPropagation()},o.innerHTML=`<b>${M.options.locale.kbdShortcuts} </b><button aria-label="Close" onclick='this.parentElement.close()'>X</button>`+`<ul><b>${M.options.locale.kbdMovement}</b><li><kbd>&#8593</kbd> ${M.options.locale.kbdPanUp}</li><li><kbd>&#8595</kbd> ${M.options.locale.kbdPanDown}</li><li><kbd>&#8592</kbd> ${M.options.locale.kbdPanLeft}</li><li><kbd>&#8594</kbd> ${M.options.locale.kbdPanRight}</li><li><kbd>+</kbd> ${M.options.locale.btnZoomIn}</li><li><kbd>-</kbd> ${M.options.locale.btnZoomOut}</li><li><kbd>shift</kbd> + <kbd>&#8592/&#8593/&#8594/&#8595</kbd> 3x ${M.options.locale.kbdPanIncrement}</li><li><kbd>ctrl</kbd> + <kbd>&#8592/&#8593/&#8594/&#8595</kbd> 0.2x ${M.options.locale.kbdPanIncrement}</li><li><kbd>shift</kbd> + <kbd>+/-</kbd> ${M.options.locale.kbdZoom}</li></ul>`+`<ul><b>${M.options.locale.kbdFeature}</b><li><kbd>&#8592/&#8593</kbd> ${M.options.locale.kbdPrevFeature}</li><li><kbd>&#8594/&#8595</kbd> ${M.options.locale.kbdNextFeature}</li></ul>`,t._container.appendChild(o),this._container},_update:function(){if(this._map){var t,e=[];for(t in this._attributions)this._attributions[t]&&e.push(t);var o=[];this.options.prefix&&o.push(this.options.prefix),e.length&&o.push(e.join(", ")),this._container.innerHTML='<summary><svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="30px" viewBox="0 0 24 24" width="30px" fill="currentColor"><path d="M0 0h24v24H0V0z" fill="none"></path><path d="M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></svg></summary><div class="mapml-attribution-container">'+`<button onclick="this.closest('.leaflet-container').querySelector('.shortcuts-dialog').showModal()" class="shortcuts-button mapml-button">${M.options.locale.kbdShortcuts}</button> | `+o.join(' <span aria-hidden="true">|</span> ')+"</div>",this._container.setAttribute("role","group"),this._container.setAttribute("aria-label",""+M.options.locale.btnAttribution)}}});L.Map.mergeOptions({attributionControl:!1,toggleableAttributionControl:!0}),L.Map.addInitHook(function(){this.options.toggleableAttributionControl&&(new ut).addTo(this)});function mt(t){return new ut(t)}function ct(t){return new ht(t)}function pt(t){return new dt(t)}var ht=L.Control.extend({options:{position:"topleft"},onAdd:function(t){var e=L.DomUtil.create("div","mapml-reload-button leaflet-bar");let o=L.DomUtil.create("button","mapml-reload-button",e);return o.innerHTML="<span aria-hidden='true'>&#x021BA</span>",o.title=M.options.locale.cmReload,o.setAttribute("type","button"),o.classList.add("mapml-button"),o.setAttribute("aria-label","Reload"),L.DomEvent.disableClickPropagation(o),L.DomEvent.on(o,"click",L.DomEvent.stop),L.DomEvent.on(o,"click",this._goReload,this),this._reloadButton=o,this._updateDisabled(),t.on("moveend",this._updateDisabled,this),e},onRemove:function(t){t.off("moveend",this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_goReload:function(t){!this._disabled&&1<this._map.options.mapEl._history.length&&this._map.options.mapEl.reload()},_updateDisabled:function(){setTimeout(()=>{L.DomUtil.removeClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","false"),this._map&&(this._disabled||this._map.options.mapEl._history.length<=1)&&(L.DomUtil.addClass(this._reloadButton,"leaflet-disabled"),this._reloadButton.setAttribute("aria-disabled","true"))},0)}}),dt=L.Control.Scale.extend({options:{maxWidth:100,updateWhenIdle:!0,position:"bottomleft"},onAdd:function(t){t._container.insertAdjacentHTML("beforeend","<output role='status' aria-live='polite' aria-atomic='true' class='mapml-screen-reader-output-scale'></output>"),this._container=L.DomUtil.create("div","mapml-control-scale");var e=L.Control.Scale.prototype.onAdd.call(this,t);return this._container.appendChild(e),this._container.setAttribute("tabindex",0),this._scaleControl=this,setTimeout(()=>{this._updateOutput(),this._focusOutput()},0),t.on("zoomend moveend",this._updateOutput,this),this._map._container.addEventListener("focus",()=>this._focusOutput()),this._container},onRemove:function(t){t.off("zoomend moveend",this._updateOutput,this)},getContainer:function(){return this._container},_pixelsToDistance:function(t,e){var o=96*window.devicePixelRatio;return"metric"===e?t/o*2.54:t/o},_scaleLength:function(t){let e=t.getAttribute("style");return parseInt(e.match(/width:\s*(\d+)px/)[1])},_focusOutput:function(){setTimeout(()=>{let t=this._map._container.querySelector(".mapml-screen-reader-output-scale");t.textContent="",setTimeout(()=>{t.textContent=this._container.getAttribute("aria-label")},100)},0)},_updateOutput:function(){let t="",e=this._scaleControl.getContainer().getElementsByClassName("leaflet-control-scale-line")[0];var o;t=this.options.metric?(o=parseFloat(this._pixelsToDistance(this._scaleLength(e),"metric").toFixed(1)),t=o+" centimeters to "+e.textContent.trim(),t=t.replace(/(\d+)\s*m\b/g,"$1 meters"),t.replace(/ km/g," kilometers")):(o=parseFloat(this._pixelsToDistance(this._scaleLength(e),"imperial").toFixed(1)),t=o+" inches to "+e.textContent.trim(),t=t.replace(/ft/g,"feet"),t.replace(/mi/g,"miles")),this._container.setAttribute("aria-label",t),this._map._container.querySelector(".mapml-screen-reader-output-scale").textContent=t}}),_t=L.Control.extend({options:{position:"topleft",title:{false:"View Fullscreen",true:"Exit Fullscreen"}},onAdd:function(t){var e=L.DomUtil.create("div","leaflet-control-fullscreen leaflet-bar leaflet-control");return this.link=L.DomUtil.create("a","leaflet-control-fullscreen-button leaflet-bar-part",e),this.link.href="#",this.link.setAttribute("role","button"),this._map=t,this._map.on("fullscreenchange",this._toggleTitle,this),this._toggleTitle(),L.DomEvent.on(this.link,"click",this._click,this),e},onRemove:function(t){t.off("fullscreenchange",this._toggleTitle,this)},_click:function(t){L.DomEvent.stopPropagation(t),L.DomEvent.preventDefault(t),this._map.toggleFullscreen(this.options)},_toggleTitle:function(){this.link.title=this.options.title[this._map.isFullscreen()]}});L.Map.include({isFullscreen:function(){return this._isFullscreen||!1},toggleFullscreen:function(t){var e=M.getClosest(this.getContainer(),"mapml-viewer,[is=web-map]");this.isFullscreen()?t&&t.pseudoFullscreen?this._disablePseudoFullscreen(e):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this._disablePseudoFullscreen(e):t&&t.pseudoFullscreen?this._enablePseudoFullscreen(e):e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT):e.msRequestFullscreen?e.msRequestFullscreen():this._enablePseudoFullscreen(e),this.getContainer().focus()},_enablePseudoFullscreen:function(t){L.DomUtil.addClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!0),this.fire("fullscreenchange")},_disablePseudoFullscreen:function(t){L.DomUtil.removeClass(t,"leaflet-pseudo-fullscreen"),this._setFullscreen(!1),this.fire("fullscreenchange")},_setFullscreen:function(t){this._isFullscreen=t;var e=M.getClosest(this.getContainer(),"mapml-viewer,[is=web-map]");t?L.DomUtil.addClass(e,"mapml-fullscreen-on"):L.DomUtil.removeClass(e,"mapml-fullscreen-on"),this.invalidateSize()},_onFullscreenChange:function(t){var e=M.getClosest(this.getContainer(),":fullscreen"),o=M.getClosest(this.getContainer(),"mapml-viewer,[is=web-map]");e!==o||this._isFullscreen?e!==o&&this._isFullscreen&&(this._setFullscreen(!1),this.fire("fullscreenchange")):(this._setFullscreen(!0),this.fire("fullscreenchange"))}}),L.Map.mergeOptions({fullscreenControl:!1}),L.Map.addInitHook(function(){var t,e;this.options.fullscreenControl&&(this.fullscreenControl=new _t(this.options.fullscreenControl),this.addControl(this.fullscreenControl)),"onfullscreenchange"in document?t="fullscreenchange":"onmozfullscreenchange"in document?t="mozfullscreenchange":"onwebkitfullscreenchange"in document?t="webkitfullscreenchange":"onmsfullscreenchange"in document&&(t="MSFullscreenChange"),t&&(e=L.bind(this._onFullscreenChange,this),this.whenReady(function(){L.DomEvent.on(document,t,e)}),this.on("unload",function(){L.DomEvent.off(document,t,e)}))});function yt(t){return new _t(t)}function ft(t){return new vt(t)}function gt(t){return new Mt(t)}function bt(t,e){return new Ct(t,e)}function xt(t){return new Et(t)}function Lt(t,e){return new St(t,e)}var vt=L.Control.extend({options:{position:"bottomright"},onAdd:function(t){L.Control.CustomLocate=L.Control.Locate.extend({start:function(){L.Control.Locate.prototype.start.call(this),t.getContainer().focus()},stop:function(){L.Control.Locate.prototype.stop.call(this),t.getContainer().focus()}}),this.locateControl=new L.Control.CustomLocate({showPopup:!1,strings:{title:M.options.locale.btnLocTrackOff},position:this.options.position,locateOptions:{maxZoom:16}}).addTo(t);var e=this.locateControl._container,o=this.locateControl;return new MutationObserver(function(t){e.classList.contains("active")&&e.classList.contains("following")?(e.firstChild.title=M.options.locale.btnLocTrackOn,o._marker.bindTooltip(M.options.locale.btnMyLocTrackOn,{permanent:!0})):e.classList.contains("active")?(e.firstChild.title=M.options.locale.btnLocTrackLastKnown,o._marker.bindTooltip(M.options.locale.btnMyLastKnownLocTrackOn)):e.firstChild.title=M.options.locale.btnLocTrackOff}).observe(e,{attributes:!0,attributeFilter:["class"]}),e},stop:function(){return this.locateControl.stop()}}),Mt=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-crosshair",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><g stroke="#fff" stroke-linecap="round" stroke-linejoin="round"><circle cx="50.028" cy="50.219" r="3.923" stroke-width="2" color="currentColor" overflow="visible"/><path stroke-width="3" d="M4.973 54.424h31.768a4.204 4.204 0 1 0 0-8.409H4.973A4.203 4.203 0 0 0 .77 50.22a4.203 4.203 0 0 0 4.204 4.205z" color="currentColor" overflow="visible"/><path stroke-width="3" d="M54.232 5.165a4.204 4.204 0 1 0-8.408 0v31.767a4.204 4.204 0 1 0 8.408 0V5.165z"/><path stroke-width="3" d="M99.288 50.22a4.204 4.204 0 0 0-4.204-4.205H63.317a4.204 4.204 0 1 0 0 8.409h31.767a4.205 4.205 0 0 0 4.204-4.205zM45.823 95.274a4.204 4.204 0 1 0 8.409 0V63.506a4.204 4.204 0 1 0-8.409 0v31.768z" color="currentColor" overflow="visible"/></g></svg>',t.isFocused=!1,this._isQueryable=!1,t.on("layerchange layeradd layerremove overlayremove",this._toggleEvents,this),t.on("popupopen",this._isMapFocused,this),L.DomEvent.on(t._container,"keydown keyup mousedown",this._isMapFocused,this),this._addOrRemoveCrosshair()},onRemove:function(t){t.off("layerchange layeradd layerremove overlayremove",this._toggleEvents),t.off("popupopen",this._isMapFocused),L.DomEvent.off(t._container,"keydown keyup mousedown",this._isMapFocused)},_toggleEvents:function(){this._hasQueryableLayer()?this._map.on("viewreset move moveend",this._addOrRemoveCrosshair,this):this._map.off("viewreset move moveend",this._addOrRemoveCrosshair,this),this._addOrRemoveCrosshair()},_addOrRemoveCrosshair:function(t){this._hasQueryableLayer()?this._container.removeAttribute("hidden"):this._container.setAttribute("hidden","")},_addOrRemoveMapOutline:function(t){var e=this._map._container;this._map.isFocused&&!this._outline?this._outline=L.DomUtil.create("div","mapml-outline",e):!this._map.isFocused&&this._outline&&(L.DomUtil.remove(this._outline),delete this._outline)},_hasQueryableLayer:function(){var t=this._map.options.mapEl.layers;if(this._map.isFocused)for(var e of t)if(e.queryable())return!0;return!1},_isMapFocused:function(t){var e;this._map._container.parentNode.activeElement?((e=this._map._container.parentNode.activeElement.classList.contains("leaflet-container"))&&["keydown"].includes(t.type)&&t.shiftKey&&9===t.keyCode?this._map.isFocused=!1:this._map.isFocused=e&&["keyup","keydown"].includes(t.type),this._map.isFocused&&this._map.fire("mapkeyboardfocused"),this._addOrRemoveMapOutline(),this._addOrRemoveCrosshair()):this._map.isFocused=!1}}),Ct=L.Path.extend({initialize:function(t,e){this.type=t.tagName.toUpperCase(),"MAP-POINT"!==this.type&&"MAP-MULTIPOINT"!==this.type||(e.fillOpacity=1),0<e.wrappers.length&&(e=Object.assign(this._convertWrappers(e.wrappers),e)),L.setOptions(this,e),this.group=this.options.group,this.options.interactive=this.options.link||this.options.properties&&this.options.onEachFeature,this._parts=[],this._markup=t,this.options.zoom=t.zoom??this.options.nativeZoom,this._convertMarkup(),(t.querySelector("map-span")||t.querySelector("map-a"))&&this._generateOutlinePoints(),this.isClosed=this._isClosed()},attachLinkHandler:function(i,n,a){let s,o=document.createElement("div"),r=document.createElement("p"),l=!1;function t(t){o.parentElement&&(l=!1,this._map.getContainer().removeChild(o))}o.classList.add("mapml-link-preview"),o.appendChild(r),i.classList.add("map-a"),n.visited&&i.classList.add("map-a-visited"),i.mousedown=t=>s={x:t.clientX,y:t.clientY},L.DomEvent.on(i,"mousedown",i.mousedown,this),i.mouseup=o=>{if(0===o.button){let t=!0,e=this.options._leafletLayer._layerEl.nextElementSibling;for(;e&&t;)e.tagName&&"LAYER-"===e.tagName.toUpperCase()&&(t=!e.queryable()),e=e.nextElementSibling;t&&s&&o.eventPhase!==Event.BUBBLING_PHASE&&Math.sqrt(Math.pow(s.x-o.clientX,2)+Math.pow(s.y-o.clientY,2))<=5&&(n.visited=!0,i.setAttribute("stroke","#6c00a2"),i.classList.add("map-a-visited"),M._handleLink(n,a))}},L.DomEvent.on(i,"mouseup",i.mouseup,this),L.DomEvent.on(i,"keypress",t=>{L.DomEvent.stop(t),13!==t.keyCode&&32!==t.keyCode||(n.visited=!0,i.setAttribute("stroke","#6c00a2"),i.classList.add("map-a-visited"),M._handleLink(n,a))},this),L.DomEvent.on(i,"mouseenter keyup",t=>{if(t.target===t.currentTarget){l=!0;let t=document.createElement("a"),e=this._map.getContainer().clientWidth;for(t.href=n.url,r.innerHTML=t.href,this._map.getContainer().appendChild(o);r.clientWidth>e/2;)r.innerHTML=r.innerHTML.substring(0,r.innerHTML.length-5)+"...";setTimeout(()=>{l&&(r.innerHTML=t.href)},1e3)}},this),L.DomEvent.on(i,"mouseout keydown mousedown",t=>{t.target===t.currentTarget&&o.parentElement&&(l=!1,this._map.getContainer().removeChild(o))},this),a.on("add",function(){L.DomEvent.on(this._map.getContainer(),"mouseout mouseenter click",t,this)},a),a.on("remove",function(){L.DomEvent.off(this._map.getContainer(),{mouseout:t,mouseenter:t,click:t})},a)},_project:function(t,e=void 0,o=void 0){let i=t||this._map,n=e||i.getPixelOrigin(),a=void 0===o?i.getZoom():o;for(var s of this._parts){s.pixelRings=this._convertRing(s.rings,i,n,a);for(var r of s.subrings)r.pixelSubrings=this._convertRing([r],i,n,a)}if(this._outline){this.pixelOutline=[];for(var l of this._outline)this.pixelOutline=this.pixelOutline.concat(this._convertRing(l,i,n,a))}},_convertRing:function(t,e,o,i){let n=e.options.crs.scale(i),a=[];for(var s of t){let t=[];for(var r of s.points){r=e.options.crs.transformation.transform(r,n);t.push(L.point(r.x,r.y)._subtract(o).round())}a.push(t)}return a},_update:function(){this._map&&this._renderer._updateFeature(this)},_convertWrappers:function(o){if(o&&0!==o.length){let t="",e={};for(var i of o)if("MAP-A"!==i.tagName.toUpperCase()&&i.className)t+=i.className+" ";else if(!e.link&&i.getAttribute("href")){let t={};t.url=i.getAttribute("href"),i.hasAttribute("target")&&(t.target=i.getAttribute("target")),i.hasAttribute("type")&&(t.type=i.getAttribute("type")),i.hasAttribute("inplace")&&(t.inPlace=!0),e.link=t}return e.className=(t+" "+this.options.className).trim(),e}},_convertMarkup:function(){if(this._markup){var i,e=this._markup.attributes;this.featureAttributes={},this.options.link&&"MAP-A"===this._markup.parentElement.tagName.toUpperCase()&&"MAP-GEOMETRY"!==this._markup.parentElement.parentElement.tagName.toUpperCase()&&(this.featureAttributes.tabindex="0");for(let t=0;t<e.length;t++)this.featureAttributes[e[t].name]=e[t].value;let o=!0;for(i of this._markup.querySelectorAll("map-coordinates")){let t=[],e=[];if(this._coordinateToArrays(i,t,e,this.options.className),o||"MAP-POLYGON"!==this.type)if("MAP-MULTIPOINT"===this.type)for(var n of t[0].points.concat(e))this._parts.push({rings:[{points:[n]}],subrings:[],cls:(`${n.cls||""} `+(this.options.className||"")).trim()});else this._parts.push({rings:t,subrings:e,cls:(`${this.featureAttributes.class||""} `+(this.options.className||"")).trim()});else this._parts[0].rings.push(t[0]),0<e.length&&(this._parts[0].subrings=this._parts[0].subrings.concat(e));o=!1}}},_generateOutlinePoints:function(){if("MAP-MULTIPOINT"!==this.type&&"MAP-POINT"!==this.type&&"MAP-LINESTRING"!==this.type&&"MAP-MULTILINESTRING"!==this.type){this._outline=[];for(var t of this._markup.querySelectorAll("map-coordinates")){let o=t.childNodes,i=0,n=document.createElement("div");o.length;for(let t=0;t<o.length;t++)0===o[t].textContent.trim().length&&o[t].remove();for(var a of o){var s,r=[];if(!a.tagName){let t="",e=((i-1)%o.length+o.length)%o.length;o[e].tagName&&(s=o[e].textContent.trim().split(/\s+/),t+=`${s[s.length-2]} ${s[s.length-1]} `),t+=a.textContent,e=((i+1)%o.length+o.length)%o.length,o[e].tagName&&(a=o[e].textContent.trim().split(/\s+/),t+=` ${a[0]} ${a[1]} `),n.innerHTML=t,this._coordinateToArrays(n,r,[],!0,this.featureAttributes.class||this.options.className),this._outline.push(r)}i++}}}},_coordinateToArrays:function(i,t,n,e=!0,a=void 0,s=[]){for(var o of i.children)this._coordinateToArrays(o,t,n,!1,o.getAttribute("class"),s.concat([o]));let r=i.textContent.replace(/(<([^>]+)>)/gi,""),l=r.trim().match(/(\S+\s+\S+)/gim),u=[],m;for(var c of l){var p=[];c.split(/\s+/gim).forEach(M._parseNumber,p);p=M.pointToPCRSPoint(L.point(p),this.options.zoom,this.options.projection,this.options.nativeCS);u.push(p),m=m?m.extend(p):L.bounds(p,p)}if(this._bounds?(this._bounds.extend(m.min),this._bounds.extend(m.max)):this._bounds=m,e)t.push({points:u});else{let e={},o=i.attributes,t=this._convertWrappers(s);t.link&&(e.tabindex="0");for(let t=0;t<o.length;t++)"class"!==o[t].name&&(e[o[t].name]=o[t].value);n.unshift({points:u,center:m.getCenter(),cls:(`${a||""} `+(t.className||"")).trim(),attr:e,link:t.link,linkTarget:t.linkTarget,linkType:t.linkType})}},_isClosed:function(){switch(this.type){case"MAP-POLYGON":case"MAP-MULTIPOLYGON":case"MAP-POINT":case"MAP-MULTIPOINT":return!0;default:return!1}},getCenter:function(){return this._bounds?this._map.options.crs.unproject(this._bounds.getCenter()):null},getPCRSCenter:function(){return this._bounds.getCenter()}}),Et=L.SVG.extend({_initContainer:function(){L.SVG.prototype._initContainer.call(this),this._container.setAttribute("role","none presentation")},_initPath:function(e,t=!0){if(e._outline){let t=L.SVG.create("path");e.options.className&&L.DomUtil.addClass(t,e.featureAttributes.class||e.options.className),L.DomUtil.addClass(t,"mapml-feature-outline"),t.style.fill="none",e.outlinePath=t}for(var o of e._parts){if(o.rings&&(this._createPath(o,e.options.className,e.featureAttributes["aria-label"],e.options.interactive,e.featureAttributes),e.outlinePath&&(o.path.style.stroke="none")),o.subrings)for(var i of o.subrings)this._createPath(i,e.options.className,i.attr["aria-label"],void 0!==i.link,i.attr);this._updateStyle(e)}t&&(t=L.stamp(e),this._layers[t]=e)},_createPath:function(t,e,o,i=!1,n=void 0){let a=L.SVG.create("path");if(t.path=a,n)for(var[s,r]of Object.entries(n))"id"!==s&&"tabindex"!==s&&a.setAttribute(s,r);else o&&a.setAttribute("aria-label",o);(t.cls||e)&&L.DomUtil.addClass(a,t.cls||e),i&&L.DomUtil.addClass(a,"leaflet-interactive")},_addPath:function(t,e=void 0,o=!0){this._rootGroup||e||this._initContainer();let i=e||this._rootGroup,n=!1;o&&t.addInteractiveTarget(t.group);for(var a of t._parts){a.path&&t.group.appendChild(a.path),o&&(t.options.link&&t.attachLinkHandler(a.path,t.options.link,t.options._leafletLayer),t.addInteractiveTarget(a.path)),!n&&t.pixelOutline&&(t.group.appendChild(t.outlinePath),n=!0);for(var s of a.subrings)s.path&&(s.link&&(t.attachLinkHandler(s.path,s.link,t.options._leafletLayer),t.addInteractiveTarget(s.path)),t.group.appendChild(s.path))}i.appendChild(t.group)},_removePath:function(t){for(var e of t._parts){e.path&&(t.removeInteractiveTarget(e.path),L.DomUtil.remove(e.path));for(var o of e.subrings)o.path&&L.DomUtil.remove(o.path)}t.outlinePath&&L.DomUtil.remove(t.outlinePath),t.removeInteractiveTarget(t.group),L.DomUtil.remove(t.group),delete this._layers[L.stamp(t)]},_updateFeature:function(t){t.pixelOutline&&this._setPath(t.outlinePath,this.geometryToPath(t.pixelOutline,!1));for(var e of t._parts){this._setPath(e.path,this.geometryToPath(e.pixelRings,t.isClosed));for(var o of e.subrings)this._setPath(o.path,this.geometryToPath(o.pixelSubrings,!1))}},_pointToMarker:function(t){return`M${t.x} ${t.y} L${t.x-12.5} ${t.y-30} C${t.x-12.5} ${t.y-50}, ${t.x+12.5} ${t.y-50}, ${t.x+12.5} ${t.y-30} L${t.x} ${t.y}z`},_updateStyle:function(t){this._updatePathStyle(t.outlinePath,t,!1,!0);for(var e of t._parts){e.path&&this._updatePathStyle(e.path,t,!0);for(var o of e.subrings)o.path&&this._updatePathStyle(o.path,t)}},_updatePathStyle:function(t,e,o=!1,i=!1){var n,a;t&&e&&(n=e.options,a=e.isClosed,n.stroke&&(!a||i)||o&&!e.outlinePath?(t.setAttribute("stroke",n.color),t.setAttribute("stroke-opacity",n.opacity),t.setAttribute("stroke-width",n.weight),t.setAttribute("stroke-linecap",n.lineCap),t.setAttribute("stroke-linejoin",n.lineJoin),n.dashArray?t.setAttribute("stroke-dasharray",n.dashArray):t.removeAttribute("stroke-dasharray"),n.dashOffset?t.setAttribute("stroke-dashoffset",n.dashOffset):t.removeAttribute("stroke-dashoffset"),n.link&&(t.setAttribute("stroke",n.link.visited?"#6c00a2":"#0000EE"),t.setAttribute("stroke-opacity","1"),t.setAttribute("stroke-width","1px"),t.setAttribute("stroke-dasharray","none"))):t.setAttribute("stroke","none"),a&&!i?n.fill?t.setAttribute("fill",n.color):(t.setAttribute("fill",n.fillColor||n.color),t.setAttribute("fill-opacity",n.fillOpacity),t.setAttribute("fill-rule",n.fillRule||"evenodd")):t.setAttribute("fill","none"))},_setPath:function(t,e){t.setAttribute("d",e)},geometryToPath:function(t,e){let o="",i,n,a,s,r,l;for(i=0,a=t.length;i<a;i++){if(1===(r=t[i]).length)return this._pointToMarker(r[0]);for(n=0,s=r.length;n<s;n++)l=r[n],o+=(n?"L":"M")+l.x+" "+l.y;o+=e?"z":""}return o||"M0 0"}}),St=L.FeatureGroup.extend({initialize:function(t,e){e.wrappers&&0<e.wrappers.length&&(e=Object.assign(M.Path.prototype._convertWrappers(e.wrappers),e)),L.LayerGroup.prototype.initialize.call(this,t,e),this._featureEl=this.options.mapmlFeature,this.layerBounds=e.layerBounds,this.zoomBounds=e.zoomBounds;var o,e=t[Object.keys(t)[0]];1===t.length&&e.options.link&&(this.options.link=e.options.link),(this.options.onEachFeature&&this.options.properties||this.options.link)&&(L.DomUtil.addClass(this.options.group,"leaflet-interactive"),this.options.link?(M.Path.prototype.attachLinkHandler.call(this,this.options.group,this.options.link,this.options._leafletLayer),this.options.group.setAttribute("role","link")):(this.options.group.setAttribute("aria-expanded","false"),this.options.group.setAttribute("role","button"),this.options.onEachFeature(this.options.properties,this),this.off("click",this._openPopup))),L.DomEvent.on(this.options.group,"keyup keydown",this._handleFocus,this),this.options.group.setAttribute("aria-label",this.options.accessibleTitle),this.options.featureID&&this.options.group.setAttribute("data-fid",this.options.featureID);for(o of t)o._groupLayer=this},onAdd:function(t){L.LayerGroup.prototype.onAdd.call(this,t),this.updateInteraction()},updateInteraction:function(){let e=this._map||this.options._leafletLayer._map;for(var o in(this.options.onEachFeature||this.options.link)&&e.featureIndex.addToIndex(this,this.getPCRSCenter(),this.options.group),this._layers){let t=this._layers[o];for(var i of t._parts){t.featureAttributes&&t.featureAttributes.tabindex&&e.featureIndex.addToIndex(t,t.getPCRSCenter(),i.path);for(var n of i.subrings)n.attr&&n.attr.tabindex&&e.featureIndex.addToIndex(t,n.center,n.path)}}},_checkRender:function(t,e,o){var i=this._featureEl.min,n=this._featureEl.max;return!(o<t||t<e)&&!(null!==i&&t<+i||null!==n&&+n<t)},_handleFocus:function(t){if([9,16,27,37,38,39,40].includes(t.keyCode)&&"keydown"===t.type){var e=this._map.featureIndex.currentIndex;if(37===t.keyCode||38===t.keyCode)L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",-1),0===e?(this._map.featureIndex.inBoundFeatures[this._map.featureIndex.inBoundFeatures.length-1].path.focus(),this._map.featureIndex.currentIndex=this._map.featureIndex.inBoundFeatures.length-1):(this._map.featureIndex.inBoundFeatures[e-1].path.focus(),this._map.featureIndex.currentIndex--);else if(39===t.keyCode||40===t.keyCode)L.DomEvent.stop(t),this._map.featureIndex.inBoundFeatures[e].path.setAttribute("tabindex",-1),e===this._map.featureIndex.inBoundFeatures.length-1?(this._map.featureIndex.inBoundFeatures[0].path.focus(),this._map.featureIndex.currentIndex=0):(this._map.featureIndex.inBoundFeatures[e+1].path.focus(),this._map.featureIndex.currentIndex++);else if(27===t.keyCode){if("g"!==(this._map.options.mapEl.shadowRoot||this._map.options.mapEl.querySelector(".mapml-web-map").shadowRoot).activeElement.nodeName)return;this._map._container.focus()}else if(9===t.keyCode){let t=this;setTimeout(function(){t._map.featureIndex.inBoundFeatures[0].path.setAttribute("tabindex",0)},0)}}else[9,16,13,27,37,38,39,40,49,50,51,52,53,54,55].includes(t.keyCode)||(this._map.featureIndex.currentIndex=0,this._map.featureIndex.inBoundFeatures[0].path.focus());"G"===t.target.tagName.toUpperCase()&&([9,13,16,37,38,39,40,49,50,51,52,53,54,55,27].includes(t.keyCode)&&"keyup"===t.type?this.openTooltip():13===t.keyCode||32===t.keyCode?(this.closeTooltip(),!this.options.link&&this.options.onEachFeature&&(L.DomEvent.stop(t),this.openPopup())):this.closeTooltip())},addLayer:function(t){!t.options.link&&t.options.interactive&&this.options.onEachFeature(this.options.properties,t),L.FeatureGroup.prototype.addLayer.call(this,t)},_previousFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.max(this._map.featureIndex.currentIndex-1,0);let e=this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];e.path.focus(),this._map.closePopup()},_nextFeature:function(t){L.DomEvent.stop(t),this._map.featureIndex.currentIndex=Math.min(this._map.featureIndex.currentIndex+1,this._map.featureIndex.inBoundFeatures.length-1);let e=this._map.featureIndex.inBoundFeatures[this._map.featureIndex.currentIndex];e.path.focus(),this._map.closePopup()},getPCRSCenter:function(){let e;for(var o in this._layers){let t=this._layers[o];e?e.extend(t.getPCRSCenter()):e=L.bounds(t.getPCRSCenter(),t.getPCRSCenter())}return e.getCenter()}}),Tt=L.Handler.extend({addHooks:function(){this._map.on({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.addEventListener("map-moveend",this.announceBounds),this._map.dragging._draggable.addEventListener("dragstart",this.dragged),this._map.options.mapEl.addEventListener("mapfocused",this.focusAnnouncement)},removeHooks:function(){this._map.off({layeradd:this.totalBounds,layerremove:this.totalBounds}),this._map.options.mapEl.removeEventListener("map-moveend",this.announceBounds),this._map.dragging._draggable.removeEventListener("dragstart",this.dragged),this._map.options.mapEl.removeEventListener("mapfocused",this.focusAnnouncement)},focusAnnouncement:function(){let i=this;setTimeout(function(){let t=(i.querySelector(".mapml-web-map")?i.querySelector(".mapml-web-map"):i).shadowRoot.querySelector(".leaflet-container");var e=i._map.getZoom();let o=M.options.locale.amZoom+" "+e;e===i._map.getMaxZoom()?o=M.options.locale.amMaxZoom+" "+o:e===i._map._layersMinZoom&&(o=M.options.locale.amMinZoom+" "+o),t.setAttribute("aria-roledescription","region "+o),setTimeout(function(){t.removeAttribute("aria-roledescription")},2e3)},0)},announceBounds:function(){if(!(0<this._traversalCall)){var o=this._map.getZoom(),i=M.pixelToPCRSBounds(this._map.getPixelBounds(),o,this._map.options.projection);let t=!0;this._map.totalLayerBounds&&(t=o<=this._map.getMaxZoom()&&o>=this._map.getMinZoom()&&this._map.totalLayerBounds.overlaps(i));let e=(this.querySelector(".mapml-web-map")?this.querySelector(".mapml-web-map"):this).shadowRoot.querySelector(".mapml-screen-reader-output");var n,i=M.options.locale.amZoom+" "+o;t?(n=(this._history[this._historyIndex-1]?this._history[this._historyIndex-1]:this._history[this._historyIndex]).zoom,o===this._map.getMaxZoom()&&o!==n?e.innerText=M.options.locale.amMaxZoom+" "+i:o===this._map._layersMinZoom&&o!==n?e.innerText=M.options.locale.amMinZoom+" "+i:e.innerText=i):(n=this._history[this._historyIndex],i=this._history[this._historyIndex-1],this.back(),this._history.pop(),n.zoom!==i.zoom?e.innerText=M.options.locale.amZoomedOut:this._map.dragging._draggable.wasDragged?e.innerText=M.options.locale.amDraggedOut:n.x>i.x?e.innerText=M.options.locale.amEastBound:n.x<i.x?e.innerText=M.options.locale.amWestBound:n.y<i.y?e.innerText=M.options.locale.amNorthBound:n.y>i.y&&(e.innerText=M.options.locale.amSouthBound)),this._map.dragging._draggable.wasDragged=!1}},totalBounds:function(t){if(t.layer._layerEl){let t=this.options.mapEl;t.whenLayersReady().then(()=>{var e,o=t.querySelectorAll("layer-");let i;for(let t=0;t<o.length;t++)o[t]._layer&&(e=o[t].extent,i&&e?i.extend(M.extentToBounds(e,"pcrs")):e&&(i=M.extentToBounds(e,"pcrs")));this.totalLayerBounds=i})}},dragged:function(){this.wasDragged=!0}}),At=L.Handler.extend({initialize:function(t){L.Handler.prototype.initialize.call(this,t),this.inBoundFeatures=[],this.outBoundFeatures=[],this.currentIndex=0,this._mapPCRSBounds=M.pixelToPCRSBounds(t.getPixelBounds(),t.getZoom(),t.options.projection)},addHooks:function(){this._map.on("mapkeyboardfocused",this._updateMapBounds,this),this._map.on("mapkeyboardfocused",this._sortIndex,this)},removeHooks:function(){this._map.off("mapkeyboardfocused",this._updateMapBounds),this._map.off("mapkeyboardfocused",this._sortIndex)},addToIndex:function(t,e,o){var i=this._mapPCRSBounds.getCenter(),i=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2));let n=this._mapPCRSBounds.contains(e)?this.inBoundFeatures:this.outBoundFeatures;i={path:o,layer:t,center:e,dist:i};o.setAttribute("tabindex",-1),n.push(i);for(let t=n.length-1;0<t&&n[t].dist<n[t-1].dist;t--){var a=n[t];n[t]=n[t-1],n[t-1]=a}this._mapPCRSBounds.contains(e)?this.inBoundFeatures=n:this.outBoundFeatures=n},cleanIndex:function(){this.currentIndex=0,this.inBoundFeatures=this.inBoundFeatures.filter(t=>{var e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&!e&&this.outBoundFeatures.push(t),t.layer._map&&e}),this.outBoundFeatures=this.outBoundFeatures.filter(t=>{var e=this._mapPCRSBounds.contains(t.center);return t.path.setAttribute("tabindex",-1),t.layer._map&&e&&this.inBoundFeatures.push(t),t.layer._map&&!e})},_sortIndex:function(){if(this.cleanIndex(),0!==this.inBoundFeatures.length){let n=this._mapPCRSBounds.getCenter();this.inBoundFeatures.sort(function(t,e){var o=t.center,i=e.center;return t.dist=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),e.dist=Math.sqrt(Math.pow(i.x-n.x,2)+Math.pow(i.y-n.y,2)),t.dist-e.dist}),this.inBoundFeatures[0].path.setAttribute("tabindex",0)}},_updateMapBounds:function(t){this._mapPCRSBounds=M.pixelToPCRSBounds(this._map.getPixelBounds(),this._map.getZoom(),this._map.options.projection)}}),It={featureIndexOverlayOption:!1,announceMovement:!1,announceScale:{metric:!0,imperial:!1},defaultExtCoor:"pcrs",defaultLocCoor:"gcrs",locale:{cmBack:"Back",cmForward:"Forward",cmReload:"Reload",cmToggleControls:"Toggle Controls",cmCopyCoords:"Copy",cmCopyMapML:"Map",cmCopyExtent:"Extent",cmCopyLocation:"Location",cmToggleDebug:"Toggle Debug Mode",cmPasteLayer:"Paste",cmViewSource:"View Map Source",lmZoomToLayer:"Zoom To Layer",lmCopyLayer:"Copy Layer",lmZoomToExtent:"Zoom To Sub-layer",lmCopyExtent:"Copy Sub-layer",lcOpacity:"Opacity",btnAttribution:"Map data attribution",btnZoomIn:"Zoom in",btnZoomOut:"Zoom out",btnFullScreen:"View Fullscreen",btnExitFullScreen:"Exit Fullscreen",btnLocTrackOn:"Show my location - location tracking on",btnMyLocTrackOn:"My current location, shown on map",btnLocTrackOff:"Show my location - location tracking off",btnLocTrackLastKnown:"Show my location - last known location shown",btnMyLastKnownLocTrackOn:"My last known location, shown on map",amZoom:"zoom level",amColumn:"column",amRow:"row",amMaxZoom:"At maximum zoom level, zoom in disabled",amMinZoom:"At minimum zoom level, zoom out disabled",amZoomedOut:"Zoomed out of bounds, returning to",amDraggedOut:"Dragged out of bounds, returning to",amEastBound:"Reached east bound, panning east disabled",amWestBound:"Reached west bound, panning west disabled",amNorthBound:"Reached north bound, panning north disabled",amSouthBound:"Reached south bound, panning south disabled",kbdShortcuts:"Keyboard shortcuts",kbdMovement:"Movement keys",kbdFeature:"Feature navigation keys",kbdPanUp:"Pan up",kbdPanDown:"Pan down",kbdPanLeft:"Pan left",kbdPanRight:"Pan right",kbdPanIncrement:"pan increment",kbdZoom:"Zoom in/out 3 levels",kbdPrevFeature:"Previous feature",kbdNextFeature:"Next feature",dfLayer:"Layer",dfExtent:"Sub-layer",popupZoom:"Zoom to here",dfPastedLayer:"Pasted layer",fIndexNoFeatures:"No features found"}};L.Map.Keyboard.include({_onKeyDown:function(t){if(!t.altKey&&!t.metaKey){var e,o=t.keyCode,i=this._map;if(o in this._panKeys)i._panAnim&&i._panAnim._inProgress||(e=this._panKeys[o],t.shiftKey&&(e=L.point(e).multiplyBy(3)),t.ctrlKey&&(e=L.point(e).divideBy(5)),i.panBy(e),i.options.maxBounds&&i.panInsideBounds(i.options.maxBounds));else if(o in this._zoomKeys)(o in{187:187,107:107,61:61,171:171}&&i.getMaxZoom()!==i.getZoom()||o in{189:189,109:109,54:54,173:173}&&i._layersMinZoom!==i.getZoom())&&i.setZoom(i.getZoom()+(t.shiftKey?3:1)*this._zoomKeys[o]);else{if(27!==o||!i._popup||!i._popup.options.closeOnEscapeKey)return;i.closePopup()}L.DomEvent.stop(t)}}});function kt(t){return new Rt(t)}function Pt(){var n=L.DomUtil.create("fieldset","mapml-layer-extent"),t=L.DomUtil.create("div","mapml-layer-item-properties",n),e=L.DomUtil.create("div","mapml-layer-item-settings",n),o=L.DomUtil.create("label","mapml-layer-item-toggle",t),i=L.DomUtil.create("input"),a=L.SVG.create("svg"),s=L.SVG.create("path"),r=L.SVG.create("path"),l=L.DomUtil.create("span"),u=L.DomUtil.create("div","mapml-layer-item-controls",t),m=L.DomUtil.create("details","mapml-layer-item-details mapml-control-layers",e),c=L.DomUtil.create("summary","",m),p=this.getMapEl(),h=this.getLayerEl(),t=L.DomUtil.create("input","",m);e.hidden=!0,n.setAttribute("aria-grabbed","false"),a.setAttribute("viewBox","0 0 24 24"),a.setAttribute("height","22"),a.setAttribute("width","22"),s.setAttribute("d","M0 0h24v24H0z"),s.setAttribute("fill","none"),r.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),a.appendChild(s),a.appendChild(r);var d=this.querySelectorAll("map-select");if(d.length){for(var _=document.createDocumentFragment(),y=0;y<d.length;y++)_.appendChild(d[y].selectdetails);e.appendChild(_)}let f=L.DomUtil.create("button","mapml-layer-item-remove-control",u);f.type="button",f.title="Remove Sub Layer",f.innerHTML="<span aria-hidden='true'>&#10005;</span>",f.classList.add("mapml-button"),f.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.remove()});let g=L.DomUtil.create("button","mapml-layer-item-settings-control",u);return g.type="button",g.title="Extent Settings",g.setAttribute("aria-expanded",!1),g.classList.add("mapml-button"),L.DomEvent.on(g,"click",t=>{!0===e.hidden?(g.setAttribute("aria-expanded",!0),e.hidden=!1):(g.setAttribute("aria-expanded",!1),e.hidden=!0)},this),l.setAttribute("aria-hidden",!0),o.appendChild(i),g.appendChild(l),l.appendChild(a),c.innerText="Opacity",c.id="mapml-extent-item-opacity-"+L.stamp(c),t.setAttribute("type","range"),t.setAttribute("min","0"),t.setAttribute("max","1.0"),t.setAttribute("step","0.1"),t.setAttribute("aria-labelledby","mapml-extent-item-opacity-"+L.stamp(c)),t.setAttribute("value",this.opacity),t.value=this._extentLayer._container.style.opacity||"1.0",t.addEventListener("change",function(t){t&&t.target&&0<=t.target.value&&t.target.value<=1&&this._extentLayer.changeOpacity(t.target.value)}.bind(this)),c=L.DomUtil.create("span","mapml-extent-item-name",o),i.type="checkbox",i.defaultChecked=this.checked,c.innerHTML=this.label,(this._layerControlCheckbox=i).addEventListener("change",function(){this.checked=!this.checked}.bind(this)),c.id="mapml-extent-item-name-{"+L.stamp(c)+"}",n.setAttribute("aria-labelledby",c.id),c.extent=this,n.ontouchstart=n.onmousedown=o=>{if("label"===o.target.parentElement.tagName.toLowerCase()&&"input"!==o.target.tagName.toLowerCase()||"label"===o.target.tagName.toLowerCase()){o.stopPropagation(),o=o instanceof TouchEvent?o.touches[0]:o;let r=n,l=n.parentNode,t=!1,u=o.clientY,e=Array.from(n.parentElement.querySelectorAll("fieldset")).indexOf(n);document.body.ontouchmove=document.body.onmousemove=a=>{a.preventDefault();var s=(a=a instanceof TouchEvent?a.touches[0]:a).clientY-u;if(t=15<Math.abs(s)||t,!(l&&!t||l&&l.childElementCount<=1||l.getBoundingClientRect().top>r.getBoundingClientRect().bottom||l.getBoundingClientRect().bottom<r.getBoundingClientRect().top)){l.classList.add("mapml-draggable"),r.style.transform="translateY("+s+"px)",r.style.pointerEvents="none";let t=a.clientX,e=a.clientY,o=("MAPML-VIEWER"===p.tagName?p:p.querySelector(".mapml-web-map")).shadowRoot,i=o.elementFromPoint(t,e),n=i&&i.closest("fieldset")?i.closest("fieldset"):r;n=Math.abs(s)<=n.offsetHeight?r:n,r.setAttribute("aria-grabbed","true"),r.setAttribute("aria-dropeffect","move"),n&&l===n.parentNode&&(n=n!==r.nextSibling?n:n.nextSibling,r!==n&&(u=a.clientY,r.style.transform=null),l.insertBefore(r,n))}},document.body.ontouchend=document.body.onmouseup=()=>{var t=Array.from(n.parentElement.querySelectorAll("fieldset")).indexOf(n);if(r.setAttribute("aria-grabbed","false"),r.removeAttribute("aria-dropeffect"),r.style.pointerEvents=null,r.style.transform=null,e!==t){let t=l.children,e=0;for(var o of t){let t=o.querySelector("span").extent;t.setAttribute("data-moving","");const i=h.src?h.shadowRoot:h;i.append(t),t.removeAttribute("data-moving"),t.extentZIndex=e,t._extentLayer.setZIndex(e),e++}}l.classList.remove("mapml-draggable"),document.body.ontouchmove=document.body.onmousemove=document.body.ontouchend=document.body.onmouseup=null}}},this._extentRootFieldset=n,this._opacitySlider=t,this._opacityControl=m,this._layerControlLabel=o,n}async function wt(){var n=L.DomUtil.create("fieldset","mapml-layer-item"),t=L.DomUtil.create("input"),e=L.DomUtil.create("span","mapml-layer-item-name"),o=L.DomUtil.create("span"),i=L.DomUtil.create("div","mapml-layer-item-properties",n),a=L.DomUtil.create("div","mapml-layer-item-settings",n),s=L.DomUtil.create("label","mapml-layer-item-toggle",i),r=L.DomUtil.create("div","mapml-layer-item-controls",i),l=L.DomUtil.create("details","mapml-layer-item-opacity mapml-control-layers",a),u=L.DomUtil.create("input"),m=L.DomUtil.create("summary"),c=L.SVG.create("svg"),p=L.SVG.create("path"),i=L.SVG.create("path"),h=L.DomUtil.create("fieldset","mapml-layer-grouped-extents"),d=this.parentNode;c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("height","22"),c.setAttribute("width","22"),c.setAttribute("fill","currentColor"),p.setAttribute("d","M0 0h24v24H0z"),p.setAttribute("fill","none"),i.setAttribute("d","M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"),c.appendChild(p),c.appendChild(i),a.hidden=!0,o.setAttribute("aria-hidden",!0);let _=L.DomUtil.create("button","mapml-layer-item-remove-control",r);_.type="button",_.title="Remove Layer",_.innerHTML="<span aria-hidden='true'>&#10005;</span>",_.classList.add("mapml-button"),L.DomEvent.on(_,"click",L.DomEvent.stop),L.DomEvent.on(_,"click",t=>{let e=0,o,i;if(i=("MAPML-VIEWER"===d.tagName?d:d.querySelector(".mapml-web-map")).shadowRoot,t.target.closest("fieldset").nextElementSibling&&!t.target.closest("fieldset").nextElementSibling.disbaled)for(o=t.target.closest("fieldset").previousElementSibling;o;)e+=2,o=o.previousElementSibling;else o="link";d.removeChild(t.target.closest("fieldset").querySelector("span").layer._layerEl),o=o?i.querySelector(".leaflet-control-attribution").firstElementChild:o=i.querySelectorAll("input")[e],o.focus()},this._layer);let y=L.DomUtil.create("button","mapml-layer-item-settings-control",r);y.type="button",y.title="Layer Settings",y.setAttribute("aria-expanded",!1),y.classList.add("mapml-button"),L.DomEvent.on(y,"click",t=>{let e=this._layer._layerEl._layerControl._container;e._isExpanded||"touch"!==t.pointerType?!0===a.hidden?(y.setAttribute("aria-expanded",!0),a.hidden=!1):(y.setAttribute("aria-expanded",!1),a.hidden=!0):e._isExpanded=!0},this._layer),t.defaultChecked=this.checked,t.type="checkbox",t.setAttribute("class","leaflet-control-layers-selector"),e.layer=this._layer,t.addEventListener("change",function(){this.checked=!this.checked}.bind(this)),this._layer._legendUrl?((r=document.createElement("a")).text=" "+this._layer._title,r.href=this._layer._legendUrl,r.target="_blank",r.draggable=!1,e.appendChild(r)):e.innerHTML=this._layer._title,e.id="mapml-layer-item-name-{"+L.stamp(e)+"}",m.innerText="Opacity",m.id="mapml-layer-item-opacity-"+L.stamp(m),l.appendChild(m),l.appendChild(u),u.setAttribute("type","range"),u.setAttribute("min","0"),u.setAttribute("max","1.0"),u.setAttribute("value",this._layer._container.style.opacity||"1.0"),u.setAttribute("step","0.1"),u.setAttribute("aria-labelledby","mapml-layer-item-opacity-"+L.stamp(m)),u.value=this._layer._container.style.opacity||"1.0",u.addEventListener("change",function(t){t&&t.target&&0<=t.target.value&&t.target.value<=1&&this._layer.changeOpacity(t.target.value)}.bind(this)),n.setAttribute("aria-grabbed","false"),n.setAttribute("aria-labelledby",e.id),n.ontouchstart=n.onmousedown=e=>{if("label"===e.target.parentElement.tagName.toLowerCase()&&"input"!==e.target.tagName.toLowerCase()||"label"===e.target.tagName.toLowerCase()){e=e instanceof TouchEvent?e.touches[0]:e;let r=n,l=n.parentNode,t=!1,u=e.clientY,o=Array.from(l.querySelectorAll("fieldset")).indexOf(n);document.body.ontouchmove=document.body.onmousemove=a=>{a.preventDefault();var s=(a=a instanceof TouchEvent?a.touches[0]:a).clientY-u;if(t=15<Math.abs(s)||t,!(l&&!t||l&&l.childElementCount<=1||l.getBoundingClientRect().top>r.getBoundingClientRect().bottom||l.getBoundingClientRect().bottom<r.getBoundingClientRect().top)){l.classList.add("mapml-draggable"),r.style.transform="translateY("+s+"px)",r.style.pointerEvents="none";let t=a.clientX,e=a.clientY,o=("MAPML-VIEWER"===d.tagName?d:d.querySelector(".mapml-web-map")).shadowRoot,i=o.elementFromPoint(t,e),n=i&&i.closest("fieldset")?i.closest("fieldset"):r;n=Math.abs(s)<=n.offsetHeight?r:n,r.setAttribute("aria-grabbed","true"),r.setAttribute("aria-dropeffect","move"),n&&l===n.parentNode&&(n=n!==r.nextSibling?n:n.nextSibling,r!==n&&(u=a.clientY,r.style.transform=null),l.insertBefore(r,n))}},document.body.ontouchend=document.body.onmouseup=()=>{var t=Array.from(l.querySelectorAll("fieldset")).indexOf(n);if(r.setAttribute("aria-grabbed","false"),r.removeAttribute("aria-dropeffect"),r.style.pointerEvents=null,r.style.transform=null,o!==t){let t=l.children,o=1;for(var e of t){let t=e.querySelector("span").layer._layerEl;t.setAttribute("data-moving",""),d.insertAdjacentElement("beforeend",t),t.removeAttribute("data-moving")}var i=d.querySelectorAll("layer-");for(let e=0;e<i.length;e++){let t=i[e]._layer;t.options.zIndex!==o&&t.setZIndex(o),o++}}l.classList.remove("mapml-draggable"),document.body.ontouchmove=document.body.onmousemove=document.body.onmouseup=null}}},s.appendChild(t),s.appendChild(e),y.appendChild(o),o.appendChild(c);let f=this.src?this.shadowRoot:this;c=f.querySelectorAll('map-link[rel=style],map-link[rel="self style"],map-link[rel="style self"]');let g;c&&(g=this.getAlternateStyles(c),g&&a.appendChild(g)),this._layerControlCheckbox=t,this._layerControlLabel=s,this._opacityControl=l,this._opacitySlider=u,this._layerControlHTML=n,this._layerItemSettingsHTML=a,this._propertiesGroupAnatomy=h,this._styles=g,h.setAttribute("aria-label","Sublayers"),h.setAttribute("hidden","");let b=f.querySelectorAll("map-extent:not([hidden])"),x=[];for(let t=0;t<b.length;t++)x.push(b[t].whenReady()),h.removeAttribute("hidden");await Promise.all(x);for(let t=0;t<b.length;t++)h.appendChild(b[t].getLayerControlHTML());return a.appendChild(h),this._layerControlHTML}var zt,Bt,Rt=L.Layer.extend({onAdd:function(t){this._container=L.DomUtil.create("div","mapml-feature-index-box",t._container),this._container.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 100 100"><path fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M0 0h100v100H0z" color="#000" overflow="visible"/></svg>',this._output=L.DomUtil.create("output","mapml-feature-index",t._container),this._output.setAttribute("role","status"),this._output.setAttribute("aria-live","polite"),this._output.setAttribute("aria-atomic","true"),this._body=L.DomUtil.create("span","mapml-feature-index-content",this._output),this._body.index=0,this._output.initialFocus=!1,t.on("focus blur popupclose",this._addOrRemoveFeatureIndex,this),t.on("moveend focus templatedfeatureslayeradd",this._checkOverlap,this),t.on("keydown",this._onKeyDown,this),this._addOrRemoveFeatureIndex()},_calculateReticleBounds:function(){let t=this._map.getPixelBounds();var e=t.getCenter(),o=Math.abs(t.min.x-t.max.x)/this._map.options.mapEl.width,i=Math.abs(t.min.y-t.max.y)/this._map.options.mapEl.height;let n=getComputedStyle(this._container).width.replace(/[^\d.]/g,"");"%"===getComputedStyle(this._container).width.slice(-1)&&(n=n*this._map.options.mapEl.width/100);var a=o*n/2,o=i*n/2,i=L.point(e.x-a,e.y+o),o=L.point(e.x+a,e.y-o),o=L.bounds(i,o);return M.pixelToPCRSBounds(o,this._map.getZoom(),this._map.options.projection)},_checkOverlap:function(t){if("focus"===t.type&&(this._output.initialFocus=!0),this._output.initialFocus)if(this._output.popupClosed)this._output.popupClosed=!1;else{this._map.fire("mapkeyboardfocused");let n=this._calculateReticleBounds(),a=this._map.featureIndex.inBoundFeatures,s=1,t=Object.keys(a),r=this._body,e=document.createElement("span");e.innerHTML=M.options.locale.fIndexNoFeatures,r.innerHTML="",r.index=0,r.allFeatures=[],t.forEach(t=>{let e=a[t].layer;var o=a[t].layer._layers;let i=L.bounds();if(o){let t=Object.keys(o);t.forEach(t=>{i=i||L.bounds(e._layers[t]._bounds.min,e._layers[t]._bounds.max),i.extend(e._layers[t]._bounds.min),i.extend(e._layers[t]._bounds.max)})}else e._bounds&&(i=L.bounds(e._bounds.min,e._bounds.max));n.overlaps(i)&&(t=a[t].path.getAttribute("aria-label"),s<8&&r.appendChild(this._updateOutput(t,s,s)),s%7!=0&&1!==s||r.allFeatures.push([]),r.allFeatures[Math.floor((s-1)/7)].push({label:t,index:s,layer:e}),r.allFeatures[1]&&1===r.allFeatures[1].length&&r.appendChild(this._updateOutput("More results",0,9)),s+=1)}),this._addToggleKeys(),1===s&&r.appendChild(e)}},_updateOutput:function(t,e,o){let i=document.createElement("span");return i.setAttribute("data-index",e),i.innerHTML=`<kbd>${o}</kbd>`+" "+t+"<span>, </span>",i},_addToggleKeys:function(){let e=this._body.allFeatures;for(let t=0;t<e.length;t++){if(0===e[t].length)return;e[t-1]&&e[t].push({label:"Previous results"}),e[t+1]&&0<e[t+1].length&&e[t].push({label:"More results"})}},_onKeyDown:function(e){var t=this._body,o=e.originalEvent.keyCode;if(49<=o&&o<=55){if(t.allFeatures[t.index]){e=t.allFeatures[t.index][o-49];if(e){let t=e.layer;t&&(this._map.featureIndex.currentIndex=e.index-1,t._popup?(this._map.closePopup(),t.openPopup()):t.options.group.focus())}}}else 56===o?this._newContent(t,-1):57===o&&this._newContent(t,1)},_newContent:function(o,t){var e=o.firstChild.getAttribute("data-index"),i=o.allFeatures[Math.floor((e-1)/7+t)];if(i&&0<i.length){o.innerHTML="",o.index+=t;for(let e=0;e<i.length;e++){var n=i[e],a=n.index||0;let t=e+1;"More results"===n.label&&(t=9),"Previous results"===n.label&&(t=8),o.appendChild(this._updateOutput(n.label,a,t))}}},_addOrRemoveFeatureIndex:function(t){if(this._output.initialFocus){if(this._output.hasAttribute("aria-hidden")){let t=this;setTimeout(function(){t._output.removeAttribute("aria-hidden")},100)}}else this._output.setAttribute("aria-hidden","true");t&&"popupclose"===t.type?(this._output.setAttribute("aria-hidden","true"),this._output.popupClosed=!0):t&&"focus"===t.type?(this._container.removeAttribute("hidden"),this._output.classList.remove("mapml-screen-reader-output")):t&&t.target._popup?this._container.setAttribute("hidden",""):t&&"blur"===t.type?(this._container.setAttribute("hidden",""),this._output.classList.add("mapml-screen-reader-output"),this._output.initialFocus=!1,this._addOrRemoveFeatureIndex()):(this._container.setAttribute("hidden",""),this._output.classList.add("mapml-screen-reader-output"))}});class Nt{constructor(t,e,o,i,n,a){this.name=t,this.min=e,this.max=o,this.value=i,this.step=n,this.layer=a}validateInput(){return!!this.name}getValue(){return this.layer._map.options.mapEl.zoom}}class Ft{constructor(t,e){this.name=t,this.value=e}validateInput(){return!(!this.name||!this.value)}getValue(){return this.value}}class Ot{constructor(t,e){this.name=t,this.layer=e}validateInput(){return!!this.name}getValue(){return this.layer._map.getSize().x}}class Dt{constructor(t,e){this.name=t,this.layer=e}validateInput(){return!!this.name}getValue(){return this.layer._map.getSize().y}}class qt{constructor(t,e,o,i,n,a,s,r){this.name=t,this.position=e,this.axis=o,i||!o||["i","j"].includes(o)?this.units=i:this.units=M.axisToCS(o).toLowerCase(),this.min=n,this.max=a,this.rel=s,this.layer=r}validateInput(){if(!this.name||!this.axis)return!1;if(("i"===this.axis||"j"===this.axis)&&!["map","tile"].includes(this.units))return!1;if(this.units){let t=M.axisToCS(this.axis);if("string"==typeof t&&t.toUpperCase()!==this.units.toUpperCase())return!1}return!0}_TCRSToPCRS(t,e){var o=this.layer._map.options.crs;return o.transformation.untransform(t,o.scale(e))}getValue(t=void 0,e=void 0){if(void 0===t&&(t=this.layer._map.getZoom()),void 0===e&&(e=this.layer._map.getPixelBounds()),"pcrs"===this.units||"gcrs"===this.units)switch(this.axis){case"longitude":case"easting":if(!this.position)return this._TCRSToPCRS(e.min,t).x;if(this.position.match(/.*?-left/i))return this._TCRSToPCRS(e.min,t).x;if(this.position.match(/.*?-right/i))return this._TCRSToPCRS(e.max,t).x;break;case"latitude":case"northing":if(!this.position)return this._TCRSToPCRS(e.min,t).y;if(this.position.match(/top-.*?/i))return this._TCRSToPCRS(e.min,t).y;if(this.position.match(/bottom-.*?/i))return this._TCRSToPCRS(e.max,t).y}else{if("tilematrix"===this.units){var i=this.layer._map.getCenter();const a=this.layer._extentLayer._templates[0].layer;var i=a._getTiledPixelBounds(i),n=a._pxBoundsToTileRange(i);let o=[];for(let e=n.min.y;e<=n.max.y;e++)for(let t=n.min.x;t<=n.max.x;t++){const s=new L.Point(t,e);s.z=a._tileZoom,o.push(s)}return o}"tile"===this.units||this.units}}}class Zt{#element;#valueSet;#attribute;#domain;constructor(t,e,o,i){var n=document.createElement("div");this.domtokenlist=n.classList,this.#valueSet=!1,this.domtokenlist.value=t??"",this.#element=e,this.#attribute=o,this.#domain=i}get valueSet(){return this.#valueSet}get length(){return this.domtokenlist.length}get value(){return this.domtokenlist.value}set value(t){null===t?this.domtokenlist.value="":(this.domtokenlist.value=t.toLowerCase(),this.#valueSet=!0,this.#element.setAttribute(this.#attribute,this.domtokenlist.value),this.#valueSet=!1)}item(t){return this.domtokenlist.item(t)}contains(t){return this.domtokenlist.contains(t)}add(t){this.domtokenlist.add(t),this.#element.setAttribute(this.#attribute,this.domtokenlist.value)}remove(t){this.domtokenlist.remove(t),this.#element.setAttribute(this.#attribute,this.domtokenlist.value)}replace(t,e){this.domtokenlist.replace(t,e),this.#element.setAttribute(this.#attribute,this.domtokenlist.value)}supports(t){return!!this.#domain.includes(t)}toggle(t,e){this.domtokenlist.toggle(t,e),this.#element.setAttribute(this.#attribute,this.domtokenlist.value)}entries(){return this.domtokenlist.entries()}forEach(t,e){this.domtokenlist.forEach(t,e)}keys(){return this.domtokenlist.keys()}values(){return this.domtokenlist.values()}}zt=window,Bt={},zt.M=Bt,function(){Bt.detectImagePath=function(t){var e=L.DomUtil.create("div","leaflet-default-icon-path",t),o=L.DomUtil.getStyle(e,"background-image")||L.DomUtil.getStyle(e,"backgroundImage");return t.removeChild(e),o=null===o||0!==o.indexOf("url")?"":o.replace(/^url\(["']?/,"").replace(/marker-icon\.png["']?\)$/,"")},Bt.mime="text/mapml";var t=zt.document.head.querySelector("map-options");Bt.options=It,t&&(Bt.options=Object.assign(Bt.options,JSON.parse(t.innerHTML))),Bt.WGS84=new L.Proj.CRS("EPSG:4326","+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs ",{origin:[-180,90],bounds:L.bounds([[-180,-90],[180,90]]),resolutions:[.703125,.3515625,.17578125,.087890625,.0439453125,.02197265625,.010986328125,.0054931640625,.00274658203125,.001373291015625,.0006866455078125,.0003433227539062,.0001716613769531,858306884766e-16,429153442383e-16,214576721191e-16,107288360596e-16,53644180298e-16,26822090149e-16,13411045074e-16,6.705522537e-7,3.352761269e-7],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>Math.round(Bt.WGS84.options.bounds.getSize().x/Bt.WGS84.options.resolutions[t])},vertical:{name:"y",min:0,max:t=>Math.round(Bt.WGS84.options.bounds.getSize().y/Bt.WGS84.options.resolutions[t])},bounds:t=>L.bounds([Bt.WGS84.options.crs.tcrs.horizontal.min,Bt.WGS84.options.crs.tcrs.vertical.min],[Bt.WGS84.options.crs.tcrs.horizontal.max(t),Bt.WGS84.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"longitude",get min(){return Bt.WGS84.options.crs.gcrs.horizontal.min},get max(){return Bt.WGS84.options.crs.gcrs.horizontal.max}},vertical:{name:"latitude",get min(){return Bt.WGS84.options.crs.gcrs.vertical.min},get max(){return Bt.WGS84.options.crs.gcrs.vertical.max}},get bounds(){return Bt.WGS84.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:-90,max:90},get bounds(){return L.latLngBounds([Bt.WGS84.options.crs.gcrs.vertical.min,Bt.WGS84.options.crs.gcrs.horizontal.min],[Bt.WGS84.options.crs.gcrs.vertical.max,Bt.WGS84.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([Bt.WGS84.options.crs.tile.horizontal.min,Bt.WGS84.options.crs.tile.vertical.min],[Bt.WGS84.options.crs.tile.horizontal.max,Bt.WGS84.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>Math.round(Bt.WGS84.options.crs.tcrs.horizontal.max(t)/Bt.WGS84.options.crs.tile.bounds.getSize().x)},vertical:{name:"row",min:0,max:t=>Math.round(Bt.WGS84.options.crs.tcrs.vertical.max(t)/Bt.WGS84.options.crs.tile.bounds.getSize().y)},bounds:t=>L.bounds([Bt.WGS84.options.crs.tilematrix.horizontal.min,Bt.WGS84.options.crs.tilematrix.vertical.min],[Bt.WGS84.options.crs.tilematrix.horizontal.max(t),Bt.WGS84.options.crs.tilematrix.vertical.max(t)])}}}),Bt.CBMTILE=new L.Proj.CRS("EPSG:3978","+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +datum=NAD83 +units=m +no_defs",{origin:[-34655800,3931e4],bounds:L.bounds([[-34655800,-39e6],[1e7,3931e4]]),resolutions:[38364.660062653464,22489.62831258996,13229.193125052918,7937.5158750317505,4630.2175937685215,2645.8386250105837,1587.5031750063501,926.0435187537042,529.1677250021168,317.50063500127004,185.20870375074085,111.12522225044451,66.1459656252646,38.36466006265346,22.48962831258996,13.229193125052918,7.9375158750317505,4.6302175937685215,2.6458386250105836,1.5875031750063502,.9260435187537043,.5291677250021167,.31750063500127,.18520870375074083,.11112522225044451,.06614596562526459],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>Math.round(Bt.CBMTILE.options.bounds.getSize().x/Bt.CBMTILE.options.resolutions[t])},vertical:{name:"y",min:0,max:t=>Math.round(Bt.CBMTILE.options.bounds.getSize().y/Bt.CBMTILE.options.resolutions[t])},bounds:t=>L.bounds([Bt.CBMTILE.options.crs.tcrs.horizontal.min,Bt.CBMTILE.options.crs.tcrs.vertical.min],[Bt.CBMTILE.options.crs.tcrs.horizontal.max(t),Bt.CBMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return Bt.CBMTILE.options.bounds.min.x},get max(){return Bt.CBMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return Bt.CBMTILE.options.bounds.min.y},get max(){return Bt.CBMTILE.options.bounds.max.y}},get bounds(){return Bt.CBMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-141.01,max:-47.74},vertical:{name:"latitude",min:40.04,max:86.46},get bounds(){return L.latLngBounds([Bt.CBMTILE.options.crs.gcrs.vertical.min,Bt.CBMTILE.options.crs.gcrs.horizontal.min],[Bt.CBMTILE.options.crs.gcrs.vertical.max,Bt.CBMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([Bt.CBMTILE.options.crs.tile.horizontal.min,Bt.CBMTILE.options.crs.tile.vertical.min],[Bt.CBMTILE.options.crs.tile.horizontal.max,Bt.CBMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>Math.round(Bt.CBMTILE.options.crs.tcrs.horizontal.max(t)/Bt.CBMTILE.options.crs.tile.bounds.getSize().x)},vertical:{name:"row",min:0,max:t=>Math.round(Bt.CBMTILE.options.crs.tcrs.vertical.max(t)/Bt.CBMTILE.options.crs.tile.bounds.getSize().y)},bounds:t=>L.bounds([0,0],[Bt.CBMTILE.options.crs.tilematrix.horizontal.max(t),Bt.CBMTILE.options.crs.tilematrix.vertical.max(t)])}}}),Bt.APSTILE=new L.Proj.CRS("EPSG:5936","+proj=stere +lat_0=90 +lat_ts=50 +lon_0=-150 +k=0.994 +x_0=2000000 +y_0=2000000 +datum=WGS84 +units=m +no_defs",{origin:[-28567784.109255,32567784.109255],bounds:L.bounds([[-28567784.109254867,-28567784.109254755],[32567784.109255023,32567784.10925506]]),resolutions:[238810.813354,119405.406677,59702.7033384999,29851.3516692501,14925.675834625,7462.83791731252,3731.41895865639,1865.70947932806,932.854739664032,466.427369832148,233.213684916074,116.606842458037,58.3034212288862,29.1517106145754,14.5758553072877,7.28792765351156,3.64396382688807,1.82198191331174,.910990956788164,.45549547826179],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>Math.round(Bt.APSTILE.options.bounds.getSize().x/Bt.APSTILE.options.resolutions[t])},vertical:{name:"y",min:0,max:t=>Math.round(Bt.APSTILE.options.bounds.getSize().y/Bt.APSTILE.options.resolutions[t])},bounds:t=>L.bounds([Bt.APSTILE.options.crs.tcrs.horizontal.min,Bt.APSTILE.options.crs.tcrs.vertical.min],[Bt.APSTILE.options.crs.tcrs.horizontal.max(t),Bt.APSTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return Bt.APSTILE.options.bounds.min.x},get max(){return Bt.APSTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return Bt.APSTILE.options.bounds.min.y},get max(){return Bt.APSTILE.options.bounds.max.y}},get bounds(){return Bt.APSTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",min:-180,max:180},vertical:{name:"latitude",min:60,max:90},get bounds(){return L.latLngBounds([Bt.APSTILE.options.crs.gcrs.vertical.min,Bt.APSTILE.options.crs.gcrs.horizontal.min],[Bt.APSTILE.options.crs.gcrs.vertical.max,Bt.APSTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([Bt.APSTILE.options.crs.tile.horizontal.min,Bt.APSTILE.options.crs.tile.vertical.min],[Bt.APSTILE.options.crs.tile.horizontal.max,Bt.APSTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>Math.round(Bt.APSTILE.options.crs.tcrs.horizontal.max(t)/Bt.APSTILE.options.crs.tile.bounds.getSize().x)},vertical:{name:"row",min:0,max:t=>Math.round(Bt.APSTILE.options.crs.tcrs.vertical.max(t)/Bt.APSTILE.options.crs.tile.bounds.getSize().y)},bounds:t=>L.bounds([0,0],[Bt.APSTILE.options.crs.tilematrix.horizontal.max(t),Bt.APSTILE.options.crs.tilematrix.vertical.max(t)])}}}),Bt.OSMTILE=L.CRS.EPSG3857,L.setOptions(Bt.OSMTILE,{origin:[-20037508.342787,20037508.342787],bounds:L.bounds([[-20037508.342787,-20037508.342787],[20037508.342787,20037508.342787]]),resolutions:[156543.0339,78271.51695,39135.758475,19567.8792375,9783.93961875,4891.969809375,2445.9849046875,1222.9924523438,611.49622617188,305.74811308594,152.87405654297,76.437028271484,38.218514135742,19.109257067871,9.5546285339355,4.7773142669678,2.3886571334839,1.1943285667419,.59716428337097,.29858214168549,.14929107084274,.074645535421371,.03732276771068573,.018661383855342866,.009330691927671433],crs:{tcrs:{horizontal:{name:"x",min:0,max:t=>Math.round(Bt.OSMTILE.options.bounds.getSize().x/Bt.OSMTILE.options.resolutions[t])},vertical:{name:"y",min:0,max:t=>Math.round(Bt.OSMTILE.options.bounds.getSize().y/Bt.OSMTILE.options.resolutions[t])},bounds:t=>L.bounds([Bt.OSMTILE.options.crs.tcrs.horizontal.min,Bt.OSMTILE.options.crs.tcrs.vertical.min],[Bt.OSMTILE.options.crs.tcrs.horizontal.max(t),Bt.OSMTILE.options.crs.tcrs.vertical.max(t)])},pcrs:{horizontal:{name:"easting",get min(){return Bt.OSMTILE.options.bounds.min.x},get max(){return Bt.OSMTILE.options.bounds.max.x}},vertical:{name:"northing",get min(){return Bt.OSMTILE.options.bounds.min.y},get max(){return Bt.OSMTILE.options.bounds.max.y}},get bounds(){return Bt.OSMTILE.options.bounds}},gcrs:{horizontal:{name:"longitude",get min(){return Bt.OSMTILE.unproject(Bt.OSMTILE.options.bounds.min).lng},get max(){return Bt.OSMTILE.unproject(Bt.OSMTILE.options.bounds.max).lng}},vertical:{name:"latitude",get min(){return Bt.OSMTILE.unproject(Bt.OSMTILE.options.bounds.min).lat},get max(){return Bt.OSMTILE.unproject(Bt.OSMTILE.options.bounds.max).lat}},get bounds(){return L.latLngBounds([Bt.OSMTILE.options.crs.gcrs.vertical.min,Bt.OSMTILE.options.crs.gcrs.horizontal.min],[Bt.OSMTILE.options.crs.gcrs.vertical.max,Bt.OSMTILE.options.crs.gcrs.horizontal.max])}},map:{horizontal:{name:"i",min:0,max:t=>t.getSize().x},vertical:{name:"j",min:0,max:t=>t.getSize().y},bounds:t=>L.bounds(L.point([0,0]),t.getSize())},tile:{horizontal:{name:"i",min:0,max:256},vertical:{name:"j",min:0,max:256},get bounds(){return L.bounds([Bt.OSMTILE.options.crs.tile.horizontal.min,Bt.OSMTILE.options.crs.tile.vertical.min],[Bt.OSMTILE.options.crs.tile.horizontal.max,Bt.OSMTILE.options.crs.tile.vertical.max])}},tilematrix:{horizontal:{name:"column",min:0,max:t=>Math.round(Bt.OSMTILE.options.crs.tcrs.horizontal.max(t)/Bt.OSMTILE.options.crs.tile.bounds.getSize().x)},vertical:{name:"row",min:0,max:t=>Math.round(Bt.OSMTILE.options.crs.tcrs.vertical.max(t)/Bt.OSMTILE.options.crs.tile.bounds.getSize().y)},bounds:t=>L.bounds([0,0],[Bt.OSMTILE.options.crs.tilematrix.horizontal.max(t),Bt.OSMTILE.options.crs.tilematrix.vertical.max(t)])}}})}(),Bt._handleLink=$,Bt.convertPCRSBounds=F,Bt.axisToXY=N,Bt.csToAxes=R,Bt._convertAndFormatPCRS=w,Bt.extentToBounds=z,Bt.axisToCS=B,Bt._parseNumber=G,Bt._splitCoordinate=j,Bt.boundsToPCRSBounds=q,Bt.pixelToPCRSBounds=Z,Bt._metaContentToObject=U,Bt._coordsToArray=H,Bt.pointToPCRSPoint=O,Bt.pixelToPCRSPoint=D,Bt._gcrsToTileMatrix=X,Bt._pasteLayer=J,Bt._properties2Table=Q,Bt._updateExtent=tt,Bt.geojson2mapml=et,Bt._breakArray=ot,Bt._table2properties=it,Bt._geometry2geojson=nt,Bt._pcrsToGcrs=at,Bt.mapml2geojson=st,Bt.getMaxZoom=rt,Bt.getBoundsFromMeta=Y,Bt.getZoomBoundsFromMeta=V,Bt.getZoomBounds=K,Bt.getNativeVariables=W,Bt.getClosest=lt,Bt.QueryHandler=k,Bt.ContextMenu=P,Bt.AnnounceMovement=Tt,Bt.FeatureIndex=At,L.Map.addInitHook("addHandler","query",Bt.QueryHandler),L.Map.addInitHook("addHandler","contextMenu",Bt.ContextMenu),L.Map.addInitHook("addHandler","announceMovement",Bt.AnnounceMovement),L.Map.addInitHook("addHandler","featureIndex",Bt.FeatureIndex),Bt.MapMLLayer=g,Bt.mapMLLayer=l,Bt.ImageLayer=f,Bt.imageLayer=r,Bt.TemplatedImageLayer=y,Bt.templatedImageLayer=s,Bt.TemplatedFeaturesLayer=_,Bt.templatedFeaturesLayer=a,Bt.ExtentLayer=d,Bt.extentLayer=n,Bt.TemplatedTileLayer=h,Bt.templatedTileLayer=i,Bt.FeatureLayer=p,Bt.featureLayer=o,Bt.LayerControl=c,Bt.layerControl=e,Bt.AttributionButton=ut,Bt.attributionButton=mt,Bt.ReloadButton=ht,Bt.reloadButton=ct,Bt.ScaleBar=dt,Bt.scaleBar=pt,Bt.FullscreenButton=_t,Bt.fullscreenButton=yt,Bt.geolocationButton=ft,Bt.StaticTileLayer=m,Bt.staticTileLayer=t,Bt.DebugOverlay=b,Bt.debugOverlay=u,Bt.Crosshair=Mt,Bt.crosshair=gt,Bt.FeatureIndexOverlay=Rt,Bt.featureIndexOverlay=kt,Bt.Path=Ct,Bt.path=bt,Bt.FeatureRenderer=Et,Bt.featureRenderer=xt,Bt.Geometry=St,Bt.geometry=Lt,Bt._createLayerControlExtentHTML=Pt,Bt._createLayerControlHTML=wt,Bt.ZoomInput=Nt,Bt.HiddenInput=Ft,Bt.WidthInput=Ot,Bt.HeightInput=Dt,Bt.LocationInput=qt,Bt.TILE_SIZE=256,Bt.FALLBACK_PROJECTION="OSMTILE",Bt.FALLBACK_CS="TILEMATRIX",Bt.BLANK_TT_TREF="mapmltemplatedtileplaceholder",Bt.DOMTokenList=Zt}();
//# sourceMappingURL=mapml.js.map